53个文件已修改
1个文件已删除
26个文件已添加
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.util.Objects; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | 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.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @author mitao |
| | |
| | | @ApiOperation("历史数据分页查询") |
| | | public R<PageDTO<BasicDataVO>> list(@Validated @RequestBody HistoryDataQuery dto) { |
| | | String areaCode = SecurityUtils.getLoginUser().getUser().getAreaCode(); |
| | | Page<TbBasicData> page = tbBasicDataService.lambdaQuery().eq(TbBasicData::getDeptAreaCode, areaCode) |
| | | Page<TbBasicData> page = tbBasicDataService.lambdaQuery() |
| | | .eq(TbBasicData::getDeptAreaCode, areaCode) |
| | | .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())); |
| | | return R.ok(PageDTO.of(page, BasicDataVO.class)); |
| | | } |
| | | |
| | | /** |
| | | * 字段查看 |
| | | * |
| | | * @param id 基础数据id |
| | | * @return R<BasicDataFieldVO> |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 得分计算 |
| | | * |
| | | * @param query 得分计算条件查询对象 |
| | | * @return R<PageDTO < ScoreVO>> |
| | | */ |
| | |
| | | # 开发环境配置 |
| | | server: |
| | | # 服务器的HTTP端口,默认为8080 |
| | | port: 8084 |
| | | port: 8082 |
| | | servlet: |
| | | # 应用的访问路径 |
| | | context-path: / |
| | |
| | | devtools: |
| | | restart: |
| | | # 热部署开关 |
| | | enabled: true |
| | | enabled: false |
| | | # redis 配置 |
| | | redis: |
| | | # 地址 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>ruoyi</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.8.6</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <packaging>jar</packaging> |
| | | <artifactId>ruoyi-admin</artifactId> |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>ruoyi</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.8.6</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <packaging>jar</packaging> |
| | | <artifactId>ruoyi-admin</artifactId> |
| | | |
| | | <description> |
| | | web服务入口 |
| | | </description> |
| | | <description> |
| | | web服务入口 |
| | | </description> |
| | | |
| | | <dependencies> |
| | | <dependencies> |
| | | |
| | | <dependency> |
| | | <groupId>com.aliyun.oss</groupId> |
| | | <artifactId>aliyun-sdk-oss</artifactId> |
| | | <version>3.8.0</version> |
| | | </dependency> |
| | | <!-- spring-boot-devtools --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <optional>true</optional> <!-- 表示依赖不会传递 --> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.aliyun.oss</groupId> |
| | | <artifactId>aliyun-sdk-oss</artifactId> |
| | | <version>3.8.0</version> |
| | | </dependency> |
| | | <!-- spring-boot-devtools --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <optional>true</optional> <!-- 表示依赖不会传递 --> |
| | | </dependency> |
| | | |
| | | <!-- swagger3--> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-boot-starter</artifactId> |
| | | </dependency> |
| | | <!-- swagger3--> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-boot-starter</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.github.xiaoymin</groupId>--> |
| | | <!-- <artifactId>swagger-bootstrap-ui</artifactId>--> |
| | | <!-- <version>1.9.6</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.github.xiaoymin</groupId>--> |
| | | <!-- <artifactId>swagger-bootstrap-ui</artifactId>--> |
| | | <!-- <version>1.9.6</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | |
| | | <!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 --> |
| | | <dependency> |
| | | <groupId>io.swagger</groupId> |
| | | <artifactId>swagger-models</artifactId> |
| | | <version>1.6.2</version> |
| | | </dependency> |
| | | <!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 --> |
| | | <dependency> |
| | | <groupId>io.swagger</groupId> |
| | | <artifactId>swagger-models</artifactId> |
| | | <version>1.6.2</version> |
| | | </dependency> |
| | | |
| | | <!-- Mysql驱动包 --> |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | </dependency> |
| | | <!-- Mysql驱动包 --> |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 核心模块--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-framework</artifactId> |
| | | </dependency> |
| | | <!-- 核心模块--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-framework</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 定时任务--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-quartz</artifactId> |
| | | </dependency> |
| | | <!-- 定时任务--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-quartz</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- 代码生成--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-generator</artifactId> |
| | | </dependency> |
| | | <!-- 代码生成--> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-generator</artifactId> |
| | | </dependency> |
| | | |
| | | <!--二维码开发工具集--> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | </dependency> |
| | | <!--二维码开发工具集--> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- zxing生成二维码 --> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>core</artifactId> |
| | | <version>3.3.3</version> |
| | | </dependency> |
| | | <!-- zxing生成二维码 --> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>core</artifactId> |
| | | <version>3.3.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>javase</artifactId> |
| | | <version>3.3.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | | <artifactId>javase</artifactId> |
| | | <version>3.3.3</version> |
| | | </dependency> |
| | | |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.httpcomponents</groupId>--> |
| | | <!-- <artifactId>httpcore</artifactId>--> |
| | | <!-- <version>4.3.2</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-test</artifactId> |
| | | <version>5.1.3.RELEASE</version> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.httpcomponents</groupId>--> |
| | | <!-- <artifactId>httpcore</artifactId>--> |
| | | <!-- <version>4.3.2</version>--> |
| | | <!-- </dependency>--> |
| | | <dependency> |
| | | <groupId>com.squareup.okhttp3</groupId> |
| | | <artifactId>okhttp</artifactId> |
| | | <version>4.9.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.squareup.okhttp3</groupId> |
| | | <artifactId>okhttp</artifactId> |
| | | <version>4.9.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | <version>1.2.78</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | <version>1.2.78</version> |
| | | </dependency> |
| | | <!-- 阿里云短信 --> |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>dysmsapi20170525</artifactId> |
| | | <version>2.0.10</version> |
| | | </dependency> |
| | | |
| | | <!-- 阿里云短信 --> |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>dysmsapi20170525</artifactId> |
| | | <version>2.0.10</version> |
| | | </dependency> |
| | | <!-- JSR 303 规范验证包 --> |
| | | <dependency> |
| | | <groupId>org.hibernate</groupId> |
| | | <artifactId>hibernate-validator</artifactId> |
| | | <version>5.2.4.Final</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <!-- JSR 303 规范验证包 --> |
| | | <dependency> |
| | | <groupId>org.hibernate</groupId> |
| | | <artifactId>hibernate-validator</artifactId> |
| | | <version>5.2.4.Final</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <version>2.5.15</version> |
| | | <configuration> |
| | | <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 --> |
| | | </configuration> |
| | | <executions> |
| | | <execution> |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-war-plugin</artifactId> |
| | | <version>3.1.0</version> |
| | | <configuration> |
| | | <failOnMissingWebXml>false</failOnMissingWebXml> |
| | | <warName>${project.artifactId}</warName> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | <finalName>${project.artifactId}</finalName> |
| | | </build> |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <version>2.5.15</version> |
| | | <configuration> |
| | | <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 --> |
| | | </configuration> |
| | | <executions> |
| | | <execution> |
| | | <goals> |
| | | <goal>repackage</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-war-plugin</artifactId> |
| | | <version>3.1.0</version> |
| | | <configuration> |
| | | <failOnMissingWebXml>false</failOnMissingWebXml> |
| | | <warName>${project.artifactId}</warName> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | <finalName>${project.artifactId}</finalName> |
| | | </build> |
| | | |
| | | </project> |
| | |
| | | import com.ruoyi.system.vo.BasicDataConfigVO; |
| | | import com.ruoyi.system.vo.FieldVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.util.List; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 分页条件查询字段 |
| | | * |
| | | * @param query 字段条件查询对象 |
| | | * @return R<PageDTO < FieldVO>> |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @GetMapping("/list-fields") |
| | | @ApiOperation(value = "查询状态为展示中字段列表", notes = "基础数据配置、大屏数据配置") |
| | | public R<List<FieldVO>> listFields() { |
| | | @ApiOperation(value = "查询状态为展示中的字段列表", notes = "基础数据配置、大屏数据配置") |
| | | @ApiImplicitParam(name = "type", value = "数字、文本、百分比", required = false, dataType = "string", paramType = "query", dataTypeClass = String.class) |
| | | public R<List<FieldVO>> listFields(String type) { |
| | | try { |
| | | return R.ok(tbFieldService.listFields()); |
| | | return R.ok(tbFieldService.listFields(type)); |
| | | } catch (Exception e) { |
| | | if (e instanceof ServiceException) { |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | log.error("查询状态为展示中字段列表异常", e); |
| | | return R.fail(); |
| | | } |
| | |
| | | |
| | | @PostMapping("/edit-data-indicators") |
| | | @ApiOperation("编辑数据指标标级配置") |
| | | public R<DataScreenConfigVO> editDataIndicatorsConfig( |
| | | @Validated @RequestBody DataIndicatorsUpdDTO dto) { |
| | | public R<List<DataScreenConfigVO>> editDataIndicatorsConfig( |
| | | @Validated @RequestBody List<DataIndicatorsUpdDTO> dtoList) { |
| | | try { |
| | | return R.ok(tbDataScreenConfigService.editDataIndicatorsConfig(dto)); |
| | | return R.ok(tbDataScreenConfigService.editDataIndicatorsConfig(dtoList)); |
| | | } catch (Exception e) { |
| | | if (e instanceof ServiceException) { |
| | | return R.fail(e.getMessage()); |
| | |
| | | |
| | | @PostMapping("/edit-formal-indicators") |
| | | @ApiOperation("编辑形式指标标级配置") |
| | | public R<DataScreenConfigVO> editFormalIndicatorsConfig( |
| | | @Validated @RequestBody FormalIndicatorsUpdDTO dto) { |
| | | public R<List<DataScreenConfigVO>> editFormalIndicatorsConfig( |
| | | @Validated @RequestBody List<FormalIndicatorsUpdDTO> dtoList) { |
| | | try { |
| | | return R.ok(tbDataScreenConfigService.editFormalIndicatorsConfig(dto)); |
| | | return R.ok(tbDataScreenConfigService.editFormalIndicatorsConfig(dtoList)); |
| | | } catch (Exception e) { |
| | | if (e instanceof ServiceException) { |
| | | return R.fail(e.getMessage()); |
| | |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.BeanUtils; |
| | | import com.ruoyi.common.utils.CollUtils; |
| | | import com.ruoyi.common.utils.EasyExcelUtil; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.system.dto.update.DeptFocusDTO; |
| | | import com.ruoyi.system.dto.update.DeptUpdateDTO; |
| | | import com.ruoyi.system.handler.CustomCellWriteHandler; |
| | | import com.ruoyi.system.handler.TitleHandler; |
| | | import com.ruoyi.system.query.DeptQuery; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.TbDeptService; |
| | |
| | | import com.ruoyi.web.controller.lisenter.DeptImportListener; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.io.InputStream; |
| | | import java.net.URLEncoder; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | 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.RequestParam; |
| | | import org.springframework.web.bind.annotation.RequestPart; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.InputStream; |
| | | import java.net.URLEncoder; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private final HttpServletResponse response; |
| | | private final TbDeptService tbDeptService; |
| | | private final ISysUserService sysUserService; |
| | | |
| | | /** |
| | | * 导入模板下载 |
| | | */ |
| | |
| | | // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系 |
| | | String fileName = URLEncoder.encode("部门导入模板", "UTF-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | EasyExcel.write(response.getOutputStream(), DeptExcel.class).sheet("模板").doWrite(CollUtils.emptyList()); |
| | | Map<Integer, String[]> selectedMap = new HashMap<>(); |
| | | selectedMap.put(3, new String[]{"省本级", "市", "开发区", "县"}); |
| | | selectedMap.put(4, new String[]{"是", "否"}); |
| | | EasyExcel.write(response.getOutputStream(), DeptExcel.class).sheet("模板") |
| | | .registerWriteHandler(EasyExcelUtil.getStyleStrategy()) |
| | | .registerWriteHandler(new CustomCellWriteHandler()) |
| | | .registerWriteHandler(new TitleHandler(selectedMap)) |
| | | .doWrite(CollUtils.emptyList()); |
| | | } catch (Exception e) { |
| | | log.error("模板下载异常",e); |
| | | log.error("模板下载异常", e); |
| | | throw new ServiceException("模板下载失败,请联系管理员!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 导入 |
| | | * |
| | | * @param file 文件 |
| | | * @return R |
| | | */ |
| | | @PostMapping("/import") |
| | | @ApiOperation("导入") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Void> importExcel(@RequestPart("file")MultipartFile file) { |
| | | public R<Void> importExcel(@RequestPart("file") MultipartFile file) { |
| | | try { |
| | | //tbDeptService.importExcel(file); |
| | | InputStream inputStream = file.getInputStream(); |
| | | EasyExcel.read(inputStream, DeptExcel.class, new DeptImportListener(sysUserService)).sheet().doRead(); |
| | | EasyExcel.read(inputStream, DeptExcel.class, new DeptImportListener(sysUserService)) |
| | | .sheet().doRead(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | if (e instanceof ServiceException) { |
| | |
| | | |
| | | /** |
| | | * 分页条件查询 |
| | | * |
| | | * @param query 查询条件 |
| | | * @return R<PageVO<DeptVO>> |
| | | * @return R<PageVO < DeptVO>> |
| | | */ |
| | | @PostMapping("/page") |
| | | @ApiOperation("分页条件查询") |
| | |
| | | |
| | | /** |
| | | * 根据id查询部门详情 |
| | | * |
| | | * @param userId 部门id |
| | | * @return DeptVO |
| | | */ |
| | |
| | | @ApiOperation("根据id查询部门详情") |
| | | public R<DeptVO> getDetails(@RequestParam Long userId) { |
| | | try { |
| | | Optional<SysUser> sysUser = sysUserService.lambdaQuery().eq(SysUser::getUserId, userId).oneOpt(); |
| | | Optional<SysUser> sysUser = sysUserService.lambdaQuery().eq(SysUser::getUserId, userId) |
| | | .oneOpt(); |
| | | if (sysUser.isPresent()) { |
| | | return R.ok(BeanUtils.copyBean(sysUser.get(),DeptVO.class)); |
| | | return R.ok(BeanUtils.copyBean(sysUser.get(), DeptVO.class)); |
| | | } |
| | | } catch (Exception e) { |
| | | if (e instanceof ServiceException) { |
| | |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param dto 部门更新实体 |
| | | * @return 响应成功 |
| | | */ |
| | | @PostMapping("/edit") |
| | | @ApiOperation("编辑") |
| | | public R<Void> edit(@RequestBody DeptUpdateDTO dto){ |
| | | public R<Void> edit(@RequestBody DeptUpdateDTO dto) { |
| | | try { |
| | | dto.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | | sysUserService.lambdaUpdate().set(SysUser::getAreaAlias, dto.getAreaAlias()) |
| | |
| | | |
| | | /** |
| | | * 重点关注 |
| | | * |
| | | * @param dto 部门更新实体 |
| | | * @return 响应成功 |
| | | */ |
| | | @PostMapping("/focus") |
| | | @ApiOperation("重点关注") |
| | | public R<Object> focus(@RequestBody DeptFocusDTO dto){ |
| | | tbDeptService.focus(dto); |
| | | public R<Object> focus(@RequestBody DeptFocusDTO dto) { |
| | | tbDeptService.focus(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 部门未上传季度数据提示 |
| | | * |
| | | * @return Void |
| | | */ |
| | | @PostMapping("/reporting-message") |
| | | @ApiOperation(value = "部门未上传季度数据提示",notes = "code=200不展示,code=500 展示返回的msg") |
| | | public R<Void> reportingMessage(){ |
| | | @ApiOperation(value = "部门未上传季度数据提示", notes = "code=200不展示,code=500 展示返回的msg") |
| | | public R<Void> reportingMessage() { |
| | | return tbDeptService.reportingMessage(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.api.screen; |
| | | |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.query.TransferPaymentScaleQuery; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.vo.BasicDataVO; |
| | | import com.ruoyi.system.vo.ProvinceStaticsVO; |
| | | import com.ruoyi.system.vo.RiskAndTransferVO; |
| | | import com.ruoyi.system.vo.RiskRankingVO; |
| | | import com.ruoyi.system.vo.TransferPaymentScaleVO; |
| | | import com.ruoyi.web.controller.service.ScreenService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.util.List; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | 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; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/15 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/screen") |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "大屏财政运行总体接口") |
| | | public class ScreenGeneralController { |
| | | |
| | | private final ISysUserService sysUserService; |
| | | private final ScreenService screenService; |
| | | |
| | | @ApiOperation("全省统计数") |
| | | @GetMapping("/province-statics") |
| | | public R<ProvinceStaticsVO> provinceStatics() { |
| | | ProvinceStaticsVO vo = screenService.provinceStatics(); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | | @ApiOperation(value = "风险等级分布占比/得分分布/转移支付规模") |
| | | @GetMapping("/risk-and-payment-scale") |
| | | public R<RiskAndTransferVO> getRiskAndTransfer() { |
| | | RiskAndTransferVO vo = null; |
| | | try { |
| | | vo = screenService.getRiskAndTransfer(); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.ok(vo); |
| | | } |
| | | |
| | | @ApiOperation("转移支付规模季度列表") |
| | | @GetMapping("/quarter-list") |
| | | public R<List<BasicDataVO>> quarterList() { |
| | | return R.ok(screenService.quarterList()); |
| | | } |
| | | |
| | | @ApiOperation("转移支付规模分页查询") |
| | | @PostMapping("/transfer-payment-scale-page") |
| | | public R<PageDTO<TransferPaymentScaleVO>> transferPaymentScalePage(@Validated |
| | | @RequestBody TransferPaymentScaleQuery query) { |
| | | PageDTO<TransferPaymentScaleVO> page = screenService.transferPaymentScalePage(query); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @ApiOperation("区/县风险排名前十") |
| | | @GetMapping("/risk-ranking") |
| | | public R<List<RiskRankingVO>> riskRanking() { |
| | | try { |
| | | return R.ok(screenService.riskRanking()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.api.screen; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.BeanUtils; |
| | | import com.ruoyi.system.query.CalculateDetailQuery; |
| | | import com.ruoyi.system.query.DeptCalculateDetailQuery; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.TbScoreService; |
| | | import com.ruoyi.system.vo.CurrentFieldsDetailVO; |
| | | import com.ruoyi.system.vo.DataAnalysisVO; |
| | | import com.ruoyi.system.vo.DeptCalculateDetailVO; |
| | | import com.ruoyi.system.vo.DeptVO; |
| | | import com.ruoyi.system.vo.QuestionVO; |
| | | import com.ruoyi.system.vo.ScoreCalculateDetailVO; |
| | | import com.ruoyi.web.controller.service.ScreenService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.util.List; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | 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.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/15 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/screen") |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "大屏分析评估系统接口") |
| | | public class ScreenInnerController { |
| | | |
| | | private final ISysUserService sysUserService; |
| | | private final ScreenService screenService; |
| | | private final TbScoreService tbScoreService; |
| | | |
| | | @ApiOperation("部门列表-区县下拉框") |
| | | @GetMapping("/dept-list") |
| | | @ApiImplicitParam(name = "areaCode", value = "市级区划代码", dataType = "String", dataTypeClass = String.class) |
| | | public R<List<DeptVO>> deptList(String areaCode) { |
| | | List<SysUser> list = screenService.getCountyList(areaCode); |
| | | return R.ok(BeanUtils.copyList(list, DeptVO.class)); |
| | | } |
| | | |
| | | // @ApiOperation(value = "监管发现问题") |
| | | @GetMapping("/questions") |
| | | public R<List<QuestionVO>> queryQuestions() { |
| | | try { |
| | | return R.ok(screenService.queryQuestions()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("数据分析系统页面数据") |
| | | @GetMapping("/data") |
| | | public R<DataAnalysisVO> getDataAnalysis(@RequestParam("areaCode") String areaCode) { |
| | | try { |
| | | return R.ok(screenService.getDataAnalysis(areaCode)); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("获取点击字段弹窗数据") |
| | | @PostMapping("/fields-detail") |
| | | public R<ScoreCalculateDetailVO> fieldsDetail( |
| | | @Validated @RequestBody CalculateDetailQuery query) { |
| | | return R.ok(screenService.fieldsDetail(query)); |
| | | } |
| | | |
| | | @ApiOperation("获取点击部门得分弹窗数据") |
| | | @PostMapping("/dept-detail") |
| | | public R<List<DeptCalculateDetailVO>> deptDetail( |
| | | @Validated @RequestBody DeptCalculateDetailQuery query) { |
| | | try { |
| | | return R.ok(screenService.deptCalculateDetail(query)); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("查看原始数据") |
| | | @GetMapping("/view-raw-data") |
| | | public R<CurrentFieldsDetailVO> viewRawData(@RequestParam("areaCode") String areaCode) { |
| | | try { |
| | | return R.ok(screenService.viewRawData(areaCode)); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.service; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | public class DepartmentRanking { |
| | | |
| | | public static final String TOTAL_SCORE_RANKING_KEY = "total_score_department_ranking"; |
| | | public static final String DATA_ONE_SCORE_RANKING_KEY = "data_one_score_department_ranking"; |
| | | public static final String DATA_TWO_SCORE_RANKING_KEY = "data_two_score_department_ranking"; |
| | | public static final String DATA_THREE_SCORE_RANKING_KEY = "data_three_score_department_ranking"; |
| | | public static final String DATA_FOUR_SCORE_RANKING_KEY = "data_four_score_department_ranking"; |
| | | |
| | | @Autowired |
| | | private RedisTemplate<String, String> redisTemplate; |
| | | |
| | | public void addToScoreRanking(String key, String areaCode, double score) { |
| | | redisTemplate.opsForZSet().add(key, areaCode, score); |
| | | } |
| | | |
| | | public Long getScoreRankByAreaCode(String key, String areaCode) { |
| | | return redisTemplate.opsForZSet() |
| | | .reverseRank(key, areaCode); // 0-based ranking |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.AreaLevelEnum; |
| | | import com.ruoyi.common.enums.DataScreenConfigEnum; |
| | | import com.ruoyi.common.enums.ReportingStatusEnum; |
| | | import com.ruoyi.common.enums.RiskLevelEnum; |
| | | import com.ruoyi.common.enums.ShowStatusEnum; |
| | | import com.ruoyi.common.enums.SubTypeEnum; |
| | | import com.ruoyi.common.enums.UserTypeEnum; |
| | | import com.ruoyi.common.utils.BeanUtils; |
| | | import com.ruoyi.common.utils.CollUtils; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.domain.TbBasicData; |
| | | import com.ruoyi.system.domain.TbBasicDataCategory; |
| | | import com.ruoyi.system.domain.TbDataScreenScore; |
| | | import com.ruoyi.system.domain.TbQuestion; |
| | | import com.ruoyi.system.query.CalculateDetailQuery; |
| | | import com.ruoyi.system.query.DeptCalculateDetailQuery; |
| | | import com.ruoyi.system.query.TransferPaymentScaleQuery; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.TbBasicDataCategoryService; |
| | | import com.ruoyi.system.service.TbBasicDataConfigService; |
| | | import com.ruoyi.system.service.TbBasicDataService; |
| | | import com.ruoyi.system.service.TbDataScreenConfigService; |
| | | import com.ruoyi.system.service.TbDataScreenScoreService; |
| | | import com.ruoyi.system.service.TbQuestionService; |
| | | import com.ruoyi.system.service.TbScoreService; |
| | | import com.ruoyi.system.vo.BasicDataVO; |
| | | import com.ruoyi.system.vo.CurrentFieldsDetailVO; |
| | | import com.ruoyi.system.vo.DataAnalysisVO; |
| | | import com.ruoyi.system.vo.DataScreenConfigVO; |
| | | import com.ruoyi.system.vo.DataScreenScoreVO; |
| | | import com.ruoyi.system.vo.DeptCalculateDetailVO; |
| | | import com.ruoyi.system.vo.FieldAndScoreDataVO; |
| | | import com.ruoyi.system.vo.ProvinceStaticsVO; |
| | | import com.ruoyi.system.vo.QuestionVO; |
| | | import com.ruoyi.system.vo.RiskAndTransferVO; |
| | | import com.ruoyi.system.vo.RiskCountVO; |
| | | import com.ruoyi.system.vo.RiskLevelVO; |
| | | import com.ruoyi.system.vo.RiskMapVO; |
| | | import com.ruoyi.system.vo.RiskRankingVO; |
| | | import com.ruoyi.system.vo.ScoreCalculateDetailVO; |
| | | import com.ruoyi.system.vo.ScoreDataVO; |
| | | import com.ruoyi.system.vo.ScoreRankVO; |
| | | import com.ruoyi.system.vo.ScoreRateDataVO; |
| | | import com.ruoyi.system.vo.TransferPaymentScaleVO; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/16 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | @RequiredArgsConstructor |
| | | public class ScreenService { |
| | | |
| | | private final ISysUserService sysUserService; |
| | | private final TbBasicDataService tbBasicDataService; |
| | | private final TbDataScreenScoreService tbDataScreenScoreService; |
| | | private final TbDataScreenConfigService tbDataScreenConfigService; |
| | | private final TbQuestionService tbQuestionService; |
| | | private final TbScoreService tbScoreService; |
| | | private final TbBasicDataConfigService tbBasicDataConfigService; |
| | | private final TbBasicDataCategoryService tbBasicDataCategoryService; |
| | | |
| | | public ProvinceStaticsVO provinceStatics() { |
| | | ProvinceStaticsVO vo = new ProvinceStaticsVO(); |
| | | int provinceCount = getCount("省本级"); |
| | | int cityCount = getCount("市"); |
| | | int developmentZonesCount = getCount("开发区"); |
| | | int countyCount = getCount("县"); |
| | | |
| | | vo.setProvinceCount(provinceCount); |
| | | vo.setCityCount(cityCount); |
| | | vo.setDevelopmentZonesCount(developmentZonesCount); |
| | | vo.setCountyCount(countyCount); |
| | | return vo; |
| | | } |
| | | |
| | | private int getCount(String level) { |
| | | return (int) sysUserService.count( |
| | | Wrappers.<SysUser>lambdaQuery().eq(SysUser::getUserType, UserTypeEnum.DEPARTMENT) |
| | | .eq(SysUser::getAreaLevel, level)); |
| | | } |
| | | |
| | | public PageDTO<TransferPaymentScaleVO> transferPaymentScalePage( |
| | | TransferPaymentScaleQuery query) { |
| | | Page<TransferPaymentScaleVO> pageVO = tbBasicDataService.transferPaymentScalePage( |
| | | new Page<TransferPaymentScaleVO>(query.getPageNum(), query.getPageSize()), |
| | | query.getQuarter()); |
| | | return PageDTO.of(pageVO); |
| | | } |
| | | |
| | | public List<BasicDataVO> quarterList() { |
| | | List<TbBasicData> list = tbBasicDataService.lambdaQuery().select(TbBasicData::getQuarter) |
| | | .groupBy(TbBasicData::getQuarter) |
| | | .eq(TbBasicData::getStatus, ReportingStatusEnum.FILLED).list(); |
| | | return BeanUtils.copyList(list, BasicDataVO.class); |
| | | } |
| | | |
| | | public RiskAndTransferVO getRiskAndTransfer() throws Exception { |
| | | String nowQuarter = DateUtils.getNowQuarter(); |
| | | RiskAndTransferVO riskAndTransferVO = new RiskAndTransferVO(); |
| | | //查询转移支付规模总额 |
| | | List<TbBasicData> list = tbBasicDataService.lambdaQuery() |
| | | .select(TbBasicData::getTransferPaymentScale) |
| | | .eq(TbBasicData::getQuarter, nowQuarter) |
| | | .eq(TbBasicData::getStatus, ReportingStatusEnum.FILLED) |
| | | .list(); |
| | | Optional<Double> reduce = list.stream() |
| | | .map(tbBasicData -> Double.parseDouble(tbBasicData.getTransferPaymentScale())) |
| | | .reduce(Double::sum); |
| | | riskAndTransferVO.setTransferPaymentScale(reduce.orElse(0D)); |
| | | //查询风险等级设置 |
| | | DataScreenConfigVO riskLevel = tbDataScreenConfigService.getRiskLevel(); |
| | | List<RiskLevelVO> riskLevelVOList = formatRiskLevel(riskLevel); |
| | | riskAndTransferVO.setRiskLevelVOList(riskLevelVOList); |
| | | RiskCountVO riskCountVO = new RiskCountVO(); |
| | | |
| | | List<TbDataScreenScore> dataScreenScoreList = tbDataScreenScoreService.selectRiskByQuarter( |
| | | nowQuarter, riskLevel.getId(), null); |
| | | for (RiskLevelVO vo : riskLevelVOList) { |
| | | long count = dataScreenScoreList.stream() |
| | | .filter(item -> item.getScore() >= vo.getMin() |
| | | && item.getScore() <= vo.getMax()).count(); |
| | | if (vo.getRiskLevel().equals(RiskLevelEnum.L1)) { |
| | | riskCountVO.setNoRiskCount((int) count); |
| | | } else if (vo.getRiskLevel().equals(RiskLevelEnum.L2)) { |
| | | riskCountVO.setLowRiskCount((int) count); |
| | | } else if (vo.getRiskLevel().equals(RiskLevelEnum.L3)) { |
| | | riskCountVO.setMediumRiskCount((int) count); |
| | | } else if (vo.getRiskLevel().equals(RiskLevelEnum.L4)) { |
| | | riskCountVO.setHighRiskCount((int) count); |
| | | } |
| | | } |
| | | //TODO |
| | | riskCountVO.setNoRiskCount(50); |
| | | riskCountVO.setLowRiskCount(45); |
| | | riskCountVO.setMediumRiskCount(30); |
| | | riskCountVO.setHighRiskCount(80); |
| | | riskAndTransferVO.setRiskCountVO(riskCountVO); |
| | | //查询风险配置对应得分 |
| | | List<RiskMapVO> riskMapVOList = tbDataScreenScoreService.queryScore4Map(nowQuarter, |
| | | riskLevel.getId()); |
| | | riskAndTransferVO.setRiskMapVOList(riskMapVOList); |
| | | return riskAndTransferVO; |
| | | } |
| | | |
| | | private List<RiskLevelVO> formatRiskLevel(DataScreenConfigVO riskLevel) { |
| | | String[] noRiskArr = riskLevel.getNoRisk().split("_"); |
| | | String[] lowRiskArr = riskLevel.getLowRisk().split("_"); |
| | | String[] mediumRiskArr = riskLevel.getMediumRisk().split("_"); |
| | | String[] highRiskArr = riskLevel.getHighRisk().split("_"); |
| | | return handleRiskLevel(noRiskArr, lowRiskArr, mediumRiskArr, |
| | | highRiskArr); |
| | | } |
| | | |
| | | private List<RiskLevelVO> handleRiskLevel(String[] noRiskArr, String[] lowRiskArr, |
| | | String[] mediumRiskArr, String[] highRiskArr) { |
| | | List<RiskLevelVO> list = new ArrayList<>(); |
| | | String min = noRiskArr[0]; |
| | | String max = noRiskArr[1]; |
| | | RiskLevelVO vo1 = new RiskLevelVO(); |
| | | vo1.setRiskLevel(RiskLevelEnum.L1); |
| | | vo1.setMin(Double.parseDouble(min)); |
| | | vo1.setMax(Double.parseDouble(max)); |
| | | list.add(vo1); |
| | | min = lowRiskArr[0]; |
| | | max = lowRiskArr[1]; |
| | | RiskLevelVO vo2 = new RiskLevelVO(); |
| | | vo2.setRiskLevel(RiskLevelEnum.L2); |
| | | vo2.setMin(Double.parseDouble(min)); |
| | | vo2.setMax(Double.parseDouble(max)); |
| | | list.add(vo2); |
| | | min = mediumRiskArr[0]; |
| | | max = mediumRiskArr[1]; |
| | | RiskLevelVO vo3 = new RiskLevelVO(); |
| | | vo3.setRiskLevel(RiskLevelEnum.L3); |
| | | vo3.setMin(Double.parseDouble(min)); |
| | | vo3.setMax(Double.parseDouble(max)); |
| | | list.add(vo3); |
| | | min = highRiskArr[0]; |
| | | max = highRiskArr[1]; |
| | | RiskLevelVO vo4 = new RiskLevelVO(); |
| | | vo4.setRiskLevel(RiskLevelEnum.L4); |
| | | vo4.setMin(Double.parseDouble(min)); |
| | | vo4.setMax(Double.parseDouble(max)); |
| | | list.add(vo4); |
| | | return list; |
| | | } |
| | | |
| | | public List<RiskRankingVO> riskRanking() throws Exception { |
| | | DataScreenConfigVO riskLevel = tbDataScreenConfigService.getRiskLevel(); |
| | | List<RiskLevelVO> riskLevelVOList = formatRiskLevel(riskLevel); |
| | | List<RiskRankingVO> voList = tbDataScreenScoreService.queryRiskRanking(riskLevel.getId(), |
| | | DateUtils.getNowQuarter(), AreaLevelEnum.COUNTY); |
| | | int rank = 1; |
| | | for (RiskRankingVO riskRankingVO : voList) { |
| | | riskRankingVO.setRank(rank++); |
| | | for (RiskLevelVO vo : riskLevelVOList) { |
| | | if (vo.getRiskLevel().equals(RiskLevelEnum.L1) |
| | | && riskRankingVO.getScore() <= vo.getMin()) { |
| | | riskRankingVO.setRiskLevel(vo.getRiskLevel().getCode()); |
| | | } |
| | | if (riskRankingVO.getScore() >= vo.getMin() |
| | | && riskRankingVO.getScore() <= vo.getMax()) { |
| | | riskRankingVO.setRiskLevel(vo.getRiskLevel().getCode()); |
| | | } |
| | | if (vo.getRiskLevel().equals(RiskLevelEnum.L4) |
| | | && riskRankingVO.getScore() >= vo.getMax()) { |
| | | riskRankingVO.setRiskLevel(vo.getRiskLevel().getCode()); |
| | | } |
| | | } |
| | | } |
| | | return voList; |
| | | } |
| | | |
| | | public List<QuestionVO> queryQuestions() throws Exception { |
| | | List<TbQuestion> list = tbQuestionService.lambdaQuery() |
| | | .eq(TbQuestion::getQuarter, DateUtils.getNowQuarter()).list(); |
| | | return BeanUtils.copyList(list, QuestionVO.class); |
| | | } |
| | | |
| | | public DataAnalysisVO getDataAnalysis(String areaCode) throws Exception { |
| | | DataAnalysisVO dataAnalysisVO = new DataAnalysisVO(); |
| | | //查询得分排名 |
| | | ScoreRankVO scoreRankVO = tbScoreService.queryRankAndScoreByAreaCode(areaCode); |
| | | if (Objects.isNull(scoreRankVO)) { |
| | | return dataAnalysisVO; |
| | | } |
| | | dataAnalysisVO.setRank(scoreRankVO.getRank()); |
| | | dataAnalysisVO.setScore(scoreRankVO.getScore()); |
| | | String nowQuarter = DateUtils.getNowQuarter(); |
| | | //查询问题 |
| | | List<TbQuestion> list = tbQuestionService.lambdaQuery() |
| | | .eq(TbQuestion::getQuarter, nowQuarter).list(); |
| | | List<QuestionVO> questionVOS = BeanUtils.copyList(list, QuestionVO.class); |
| | | dataAnalysisVO.setQuestions(questionVOS); |
| | | SysUser user = sysUserService.lambdaQuery() |
| | | .eq(SysUser::getUserType, UserTypeEnum.DEPARTMENT) |
| | | .eq(SysUser::getAreaCode, areaCode).one(); |
| | | if (Objects.isNull(user)) { |
| | | return dataAnalysisVO; |
| | | } |
| | | dataAnalysisVO.setAreaName(user.getDeptName()); |
| | | //查询风险得分 |
| | | DataScreenConfigVO riskLevel = tbDataScreenConfigService.getRiskLevel(); |
| | | List<RiskLevelVO> riskLevelVOList = formatRiskLevel(riskLevel); |
| | | List<DataScreenScoreVO> thisYearScore = tbDataScreenScoreService.queryScoreByAreaAndYear( |
| | | areaCode, riskLevel.getId(), 1); |
| | | Optional<Double> thisYear = thisYearScore.stream().map(DataScreenScoreVO::getScore) |
| | | .reduce(Double::sum); |
| | | dataAnalysisVO.setYearScore(thisYear.orElse(0D)); |
| | | List<DataScreenScoreVO> lastYearScore = tbDataScreenScoreService.queryScoreByAreaAndYear( |
| | | areaCode, riskLevel.getId(), 2); |
| | | Optional<Double> lastYear = lastYearScore.stream().map(DataScreenScoreVO::getScore) |
| | | .reduce(Double::sum); |
| | | dataAnalysisVO.setLastYearScore(lastYear.orElse(0D)); |
| | | //查询风险等级 |
| | | List<TbDataScreenScore> dataScreenScoreList = tbDataScreenScoreService.selectRiskByQuarter( |
| | | nowQuarter, |
| | | riskLevel.getId(), areaCode); |
| | | for (TbDataScreenScore tbDataScreenScore : dataScreenScoreList) { |
| | | for (RiskLevelVO vo : riskLevelVOList) { |
| | | if (vo.getRiskLevel().equals(RiskLevelEnum.L1) |
| | | && tbDataScreenScore.getScore() <= vo.getMin()) { |
| | | dataAnalysisVO.setRiskLevel(vo.getRiskLevel().getCode()); |
| | | } |
| | | if (tbDataScreenScore.getScore() >= vo.getMin() |
| | | && tbDataScreenScore.getScore() <= vo.getMax()) { |
| | | dataAnalysisVO.setRiskLevel(vo.getRiskLevel().getCode()); |
| | | } |
| | | if (vo.getRiskLevel().equals(RiskLevelEnum.L4) |
| | | && tbDataScreenScore.getScore() >= vo.getMax()) { |
| | | dataAnalysisVO.setRiskLevel(vo.getRiskLevel().getCode()); |
| | | } |
| | | } |
| | | } |
| | | //查询形式指标得分 |
| | | List<ScoreDataVO> scoreDataVOList = new ArrayList<>(); |
| | | handleDataIndicators(areaCode, scoreDataVOList); |
| | | dataAnalysisVO.setScoreDataList(scoreDataVOList); |
| | | //查询数据指标得分 |
| | | List<ScoreRateDataVO> scoreRateDataVOList = new ArrayList<>(); |
| | | handleDataIndicators(areaCode, scoreRateDataVOList, nowQuarter); |
| | | dataAnalysisVO.setScoreRateDataList(scoreRateDataVOList); |
| | | //查询大屏下方字段列表 |
| | | List<TbBasicDataCategory> categoryList = tbBasicDataCategoryService.lambdaQuery() |
| | | .eq(TbBasicDataCategory::getStatus, ShowStatusEnum.SHOW).last("limit 4").list(); |
| | | List<FieldAndScoreDataVO> voList = tbBasicDataService.selectBasicDataFieldsConfig(areaCode, |
| | | nowQuarter); |
| | | if (categoryList.isEmpty()) { |
| | | dataAnalysisVO.setScoreRateDataListOne(CollUtils.emptyList()); |
| | | dataAnalysisVO.setScoreRateDataListTwo(CollUtils.emptyList()); |
| | | dataAnalysisVO.setScoreRateDataListThree(CollUtils.emptyList()); |
| | | dataAnalysisVO.setScoreRateDataListFour(CollUtils.emptyList()); |
| | | } else { |
| | | int size = categoryList.size(); |
| | | for (int i = 0; i < 4; i++) { |
| | | List<FieldAndScoreDataVO> dataList; |
| | | if (i < size) { |
| | | dataList = getFieldAndScoreData(voList, |
| | | categoryList.get(i).getBasicDataCategoryName()); |
| | | } else { |
| | | dataList = CollUtils.emptyList(); |
| | | } |
| | | switch (i) { |
| | | case 0: |
| | | dataAnalysisVO.setScoreRateDataListOne(dataList); |
| | | break; |
| | | case 1: |
| | | dataAnalysisVO.setScoreRateDataListTwo(dataList); |
| | | break; |
| | | case 2: |
| | | dataAnalysisVO.setScoreRateDataListThree(dataList); |
| | | break; |
| | | case 3: |
| | | dataAnalysisVO.setScoreRateDataListFour(dataList); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return dataAnalysisVO; |
| | | } |
| | | |
| | | private void handleDataIndicators(String areaCode, List<ScoreDataVO> scoreDataVOList) { |
| | | List<DataScreenScoreVO> formalIndicatorsYear = tbDataScreenScoreService.selectIndicators( |
| | | areaCode, null, DataScreenConfigEnum.FORMAL_INDICATORS, 1); |
| | | if (CollUtils.isNotEmpty(formalIndicatorsYear)) { |
| | | //形式指标一 |
| | | for (SubTypeEnum value : SubTypeEnum.values()) { |
| | | ScoreDataVO scoreDataVO = new ScoreDataVO(); |
| | | scoreDataVO.setSubType(value); |
| | | List<DataScreenScoreVO> formalIndicators = formalIndicatorsYear.stream() |
| | | .filter(item -> item.getSubType().equals(value)).collect( |
| | | Collectors.toList()); |
| | | scoreDataVO.setMaxScore(formalIndicators.get(0).getMaxScore()); |
| | | Optional<Double> formalIndicatorsYearScore = formalIndicators.stream() |
| | | .map(DataScreenScoreVO::getScore) |
| | | .reduce(Double::sum); |
| | | scoreDataVO.setScore(formalIndicatorsYearScore.orElse(0D)); |
| | | List<DataScreenScoreVO> formalIndicatorsListYear = tbDataScreenScoreService.selectIndicators( |
| | | areaCode, null, DataScreenConfigEnum.FORMAL_INDICATORS, 2); |
| | | List<DataScreenScoreVO> formalIndicatorsLastYear = formalIndicatorsListYear.stream() |
| | | .filter(item -> item.getSubType().equals(value)).collect( |
| | | Collectors.toList()); |
| | | Optional<Double> formalIndicatorsListYearScore = formalIndicatorsLastYear.stream() |
| | | .map(DataScreenScoreVO::getScore) |
| | | .reduce(Double::sum); |
| | | scoreDataVO.setLastScore(formalIndicatorsListYearScore.orElse(0D)); |
| | | scoreDataVOList.add(scoreDataVO); |
| | | } |
| | | } else { |
| | | for (SubTypeEnum value : SubTypeEnum.values()) { |
| | | ScoreDataVO scoreDataVO = new ScoreDataVO(); |
| | | scoreDataVO.setScore(0D); |
| | | scoreDataVO.setLastScore(0D); |
| | | scoreDataVO.setSubType(value); |
| | | scoreDataVOList.add(scoreDataVO); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private void handleDataIndicators(String areaCode, List<ScoreRateDataVO> scoreRateDataVOList, |
| | | String nowQuarter) { |
| | | List<DataScreenScoreVO> dataIndicatorsListYear = tbDataScreenScoreService.selectIndicators( |
| | | areaCode, nowQuarter, DataScreenConfigEnum.DATA_INDICATORS, null); |
| | | if (CollUtils.isNotEmpty(dataIndicatorsListYear)) { |
| | | for (SubTypeEnum value : SubTypeEnum.values()) { |
| | | ScoreRateDataVO scoreRateDataVO = new ScoreRateDataVO(); |
| | | List<DataScreenScoreVO> formalIndicators = dataIndicatorsListYear.stream() |
| | | .filter(item -> item.getSubType().equals(value)).collect( |
| | | Collectors.toList()); |
| | | if (CollUtils.isNotEmpty(formalIndicators)) { |
| | | DataScreenScoreVO dataScreenScoreVO = formalIndicators.get(0); |
| | | scoreRateDataVO.setScore(dataScreenScoreVO.getScore()); |
| | | scoreRateDataVO.setScoreRate(dataScreenScoreVO.getScoreRate()); |
| | | scoreRateDataVO.setSubType(value); |
| | | Integer rank = tbDataScreenScoreService.getRankByScore( |
| | | dataScreenScoreVO.getScore(), |
| | | dataScreenScoreVO.getSubType(), areaCode, nowQuarter, |
| | | DataScreenConfigEnum.DATA_INDICATORS); |
| | | scoreRateDataVO.setRank(rank); |
| | | scoreRateDataVOList.add(scoreRateDataVO); |
| | | } else { |
| | | scoreRateDataVO.setScore(0D); |
| | | scoreRateDataVO.setScoreRate(0D); |
| | | scoreRateDataVO.setSubType(value); |
| | | scoreRateDataVO.setRank(0); |
| | | scoreRateDataVOList.add(scoreRateDataVO); |
| | | } |
| | | } |
| | | } else { |
| | | for (SubTypeEnum value : SubTypeEnum.values()) { |
| | | ScoreRateDataVO scoreRateDataVO = new ScoreRateDataVO(); |
| | | scoreRateDataVO.setScore(0D); |
| | | scoreRateDataVO.setScoreRate(0D); |
| | | scoreRateDataVO.setSubType(value); |
| | | scoreRateDataVO.setRank(0); |
| | | scoreRateDataVOList.add(scoreRateDataVO); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private List<FieldAndScoreDataVO> getFieldAndScoreData(List<FieldAndScoreDataVO> voList, |
| | | String basicDataCategoryName) { |
| | | return voList.stream() |
| | | .filter(item -> item.getBasicDataCategoryName() |
| | | .equals(basicDataCategoryName)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | public List<DeptCalculateDetailVO> deptCalculateDetail(DeptCalculateDetailQuery query) |
| | | throws Exception { |
| | | return tbScoreService.deptCalculateDetail(query, DateUtils.getNowQuarter()); |
| | | } |
| | | |
| | | public CurrentFieldsDetailVO viewRawData(String areaCode) throws Exception { |
| | | Optional<TbBasicData> basicDataOptional = tbBasicDataService.lambdaQuery() |
| | | .eq(TbBasicData::getDeptAreaCode, areaCode) |
| | | .eq(TbBasicData::getStatus, ReportingStatusEnum.FILLED) |
| | | .eq(TbBasicData::getQuarter, DateUtils.getNowQuarter()).oneOpt(); |
| | | if (basicDataOptional.isPresent()) { |
| | | return tbBasicDataService.fieldsDetails(basicDataOptional.get().getId()).getData(); |
| | | } else { |
| | | return new CurrentFieldsDetailVO(); |
| | | } |
| | | } |
| | | |
| | | public ScoreCalculateDetailVO fieldsDetail(CalculateDetailQuery query) { |
| | | List<SysUser> countyList = getCountyList(query.getCityAreaCode()); |
| | | return tbScoreService.fieldsDetail(query, countyList); |
| | | } |
| | | |
| | | public List<SysUser> getCountyList(String areaCode) { |
| | | String cityCode = areaCode.substring(0, 4); |
| | | List<SysUser> list = sysUserService.lambdaQuery() |
| | | .select(SysUser::getAreaCode, SysUser::getAreaName, SysUser::getAreaAlias, |
| | | SysUser::getUserId).eq(SysUser::getUserType, |
| | | UserTypeEnum.DEPARTMENT) |
| | | .ne(SysUser::getAreaCode, areaCode) |
| | | .likeRight(SysUser::getAreaCode, cityCode).list(); |
| | | return list; |
| | | } |
| | | } |
| | |
| | | public AjaxResult getUserCount() { |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | |
| | | Integer userCountSum = userService.selectCount(null); |
| | | Integer normalCount = userService.selectCount(0);// 正常 |
| | | Integer stopCount = userService.selectCount(1);// 停用 |
| | | Integer userCountSum = userService.selectCountByStatus(null); |
| | | Integer normalCount = userService.selectCountByStatus(0);// 正常 |
| | | Integer stopCount = userService.selectCountByStatus(1);// 停用 |
| | | |
| | | map.put("all", userCountSum); |
| | | map.put("normal", normalCount); |
| | |
| | | package com.ruoyi.web.controller.tool; |
| | | |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.TbBasicDataService; |
| | | import com.ruoyi.system.service.TbDataScreenConfigService; |
| | | import com.ruoyi.system.service.TbDataScreenScoreService; |
| | | import com.ruoyi.system.service.TbQuestionService; |
| | | import com.ruoyi.system.service.TbScoreService; |
| | | import com.ruoyi.system.vo.ScoreRankVO; |
| | | import com.ruoyi.web.controller.service.DepartmentRanking; |
| | | import java.util.List; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @RequiredArgsConstructor |
| | | public class TaskUtil { |
| | | |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | private final RedisCache redisCache; |
| | | private final DepartmentRanking departmentRanking; |
| | | private final ISysUserService sysUserService; |
| | | private final TbBasicDataService tbBasicDataService; |
| | | private final TbDataScreenScoreService tbDataScreenScoreService; |
| | | private final TbDataScreenConfigService tbDataScreenConfigService; |
| | | private final TbQuestionService tbQuestionService; |
| | | private final TbScoreService tbScoreService; |
| | | |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void message() { |
| | |
| | | public void taskDayOne() { |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 更新排行榜数据 |
| | | */ |
| | | @Scheduled(cron = "0 0 1 * * ? ") |
| | | public void ranking() { |
| | | List<ScoreRankVO> list = tbScoreService.queryTotalScoreList(); |
| | | } |
| | | } |
| | |
| | | # 开发环境配置 |
| | | server: |
| | | # 服务器的HTTP端口,默认为8080 |
| | | port: 8083 |
| | | port: 8081 |
| | | servlet: |
| | | # 应用的访问路径 |
| | | context-path: / |
| | |
| | | devtools: |
| | | restart: |
| | | # 热部署开关 |
| | | enabled: true |
| | | enabled: false |
| | | # redis 配置 |
| | | redis: |
| | | # 地址 |
| | |
| | | druid: |
| | | # 主库数据源 |
| | | master: |
| | | url: jdbc:mysql://192.168.110.188:3306/financialdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://192.168.110.188:3306/financialdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true |
| | | username: root |
| | | password: 123456 |
| | | # url: jdbc:mysql://8.137.10.192:3306/sys_config?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 |
| | |
| | | druid: |
| | | # 主库数据源 |
| | | master: |
| | | url: jdbc:mysql://localhost:3306/financialdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://localhost:3306/financialdb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true |
| | | username: root |
| | | password: 123456 |
| | | # url: jdbc:mysql://8.137.10.192:3306/sys_config?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8 |
New file |
| | |
| | | package com.ruoyi; |
| | | |
| | | import static com.ruoyi.web.controller.service.DepartmentRanking.DATA_ONE_SCORE_RANKING_KEY; |
| | | import static com.ruoyi.web.controller.service.DepartmentRanking.TOTAL_SCORE_RANKING_KEY; |
| | | |
| | | import com.ruoyi.web.controller.service.DepartmentRanking; |
| | | import javax.annotation.Resource; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/17 |
| | | */ |
| | | @SpringBootTest(classes = RuoYiManageApplication.class) |
| | | public class RuoYiManageApplicationTest { |
| | | |
| | | @Resource |
| | | private DepartmentRanking departmentRanking; |
| | | |
| | | @Test |
| | | public void test() { |
| | | departmentRanking.addToScoreRanking(TOTAL_SCORE_RANKING_KEY, "area1", 50); |
| | | departmentRanking.addToScoreRanking(TOTAL_SCORE_RANKING_KEY, "area2", 50); |
| | | departmentRanking.addToScoreRanking(TOTAL_SCORE_RANKING_KEY, "area3", 50); |
| | | |
| | | departmentRanking.addToScoreRanking(DATA_ONE_SCORE_RANKING_KEY, "area1", 50); |
| | | departmentRanking.addToScoreRanking(DATA_ONE_SCORE_RANKING_KEY, "area2", 80); |
| | | departmentRanking.addToScoreRanking(DATA_ONE_SCORE_RANKING_KEY, "area3", 90); |
| | | |
| | | Long score1Rank1 = departmentRanking.getScoreRankByAreaCode(TOTAL_SCORE_RANKING_KEY, |
| | | "area1"); |
| | | Long score1Rank2 = departmentRanking.getScoreRankByAreaCode(TOTAL_SCORE_RANKING_KEY, |
| | | "area2"); |
| | | Long score1Rank3 = departmentRanking.getScoreRankByAreaCode(TOTAL_SCORE_RANKING_KEY, |
| | | "area3"); |
| | | Long score2Rank1 = departmentRanking.getScoreRankByAreaCode(DATA_ONE_SCORE_RANKING_KEY, |
| | | "area1"); |
| | | Long score2Rank2 = departmentRanking.getScoreRankByAreaCode(DATA_ONE_SCORE_RANKING_KEY, |
| | | "area2"); |
| | | Long score2Rank3 = departmentRanking.getScoreRankByAreaCode(DATA_ONE_SCORE_RANKING_KEY, |
| | | "area3"); |
| | | |
| | | if (score1Rank1 != null && score2Rank1 != null) { |
| | | System.out.println("Area2's score2 rank: " + (score1Rank1 |
| | | + 1)); // Convert 0-based to 1-based ranking |
| | | System.out.println("Area2's score2 rank: " + (score1Rank2 |
| | | + 1)); // Convert 0-based to 1-based ranking |
| | | System.out.println("Area2's score2 rank: " + (score1Rank3 |
| | | + 1)); // Convert 0-based to 1-based ranking |
| | | System.out.println("Area2's score2 rank: " + (score2Rank1 |
| | | + 1)); // Convert 0-based to 1-based ranking |
| | | System.out.println("Area2's score2 rank: " + (score2Rank2 |
| | | + 1)); // Convert 0-based to 1-based ranking |
| | | System.out.println("Area2's score2 rank: " + (score2Rank3 |
| | | + 1)); // Convert 0-based to 1-based ranking |
| | | } else { |
| | | System.out.println("Area2 not found in the ranking."); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | |
| | | */ |
| | | @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") |
| | | @TableField("del_flag") |
| | | @TableLogic |
| | | private String delFlag; |
| | | |
| | | /** |
New file |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum AreaLevelEnum { |
| | | PROVINCE(1, "省本级"), |
| | | CITY(2, "市"), |
| | | DEVELOPMENT_ZONES(3, "开发区"), |
| | | COUNTY(3, "县"); |
| | | |
| | | private final Integer code; |
| | | private final String desc; |
| | | |
| | | public static AreaLevelEnum getEnumByCode(Integer code) { |
| | | for (AreaLevelEnum e : AreaLevelEnum.values()) { |
| | | if (e.code.equals(code)) { |
| | | return e; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.EnumValue; |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | import lombok.Getter; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum FieldTypeEnum { |
| | | NUMBER(1, "数字"), |
| | | TEXT(2, "文本"), |
| | | PERCENTAGE(3, "百分比"); |
| | | @EnumValue |
| | | private final Integer code; |
| | | @JsonValue |
| | | private final String desc; |
| | | NUMBER(1, "数字"), |
| | | TEXT(2, "文本"), |
| | | PERCENTAGE(3, "百分比"); |
| | | @EnumValue |
| | | private final Integer code; |
| | | @JsonValue |
| | | private final String desc; |
| | | |
| | | public static FieldTypeEnum getEnumByCode(Integer code) { |
| | | for (FieldTypeEnum e : FieldTypeEnum.values()) { |
| | | if (e.code.equals(code)) { |
| | | return e; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | public static FieldTypeEnum getEnumByCode(Integer code) { |
| | | for (FieldTypeEnum e : FieldTypeEnum.values()) { |
| | | if (e.code.equals(code)) { |
| | | return e; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static FieldTypeEnum getEnumByDesc(String desc) { |
| | | for (FieldTypeEnum e : FieldTypeEnum.values()) { |
| | | if (e.desc.equals(desc)) { |
| | | return e; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.enums; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.EnumValue; |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum RiskLevelEnum { |
| | | L1("R1", "低风险"), |
| | | L2("R2", "一般风险"), |
| | | L3("R3", "较高风险"), |
| | | L4("R4", "高风险"); |
| | | @EnumValue |
| | | private final String code; |
| | | @JsonValue |
| | | private final String desc; |
| | | |
| | | public static RiskLevelEnum getEnumByCode(String code) { |
| | | for (RiskLevelEnum e : RiskLevelEnum.values()) { |
| | | if (e.code.equals(code)) { |
| | | return e; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | public static double calculate(String expression, Map<String, Object> value) { |
| | | |
| | | expression = formatExpression(expression); |
| | | // 创建 JEXL 引擎 |
| | | JexlEngine jexl = new JexlBuilder().create(); |
| | |
| | | package com.ruoyi.framework.config; |
| | | |
| | | import com.ruoyi.framework.config.properties.PermitAllUrlProperties; |
| | | import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter; |
| | | import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl; |
| | | import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.http.HttpMethod; |
| | |
| | | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; |
| | | import org.springframework.security.web.authentication.logout.LogoutFilter; |
| | | import org.springframework.web.filter.CorsFilter; |
| | | import com.ruoyi.framework.config.properties.PermitAllUrlProperties; |
| | | import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter; |
| | | import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl; |
| | | import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl; |
| | | |
| | | /** |
| | | * spring security配置 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) |
| | | public class SecurityConfig extends WebSecurityConfigurerAdapter |
| | | { |
| | | public class SecurityConfig extends WebSecurityConfigurerAdapter { |
| | | |
| | | /** |
| | | * 自定义用户认证逻辑 |
| | | */ |
| | | @Autowired |
| | | private UserDetailsService userDetailsService; |
| | | |
| | | |
| | | /** |
| | | * 认证失败处理类 |
| | | */ |
| | |
| | | */ |
| | | @Autowired |
| | | private JwtAuthenticationTokenFilter authenticationTokenFilter; |
| | | |
| | | |
| | | /** |
| | | * 跨域过滤器 |
| | | */ |
| | |
| | | */ |
| | | @Bean |
| | | @Override |
| | | public AuthenticationManager authenticationManagerBean() throws Exception |
| | | { |
| | | public AuthenticationManager authenticationManagerBean() throws Exception { |
| | | return super.authenticationManagerBean(); |
| | | } |
| | | |
| | | /** |
| | | * anyRequest | 匹配所有请求路径 |
| | | * access | SpringEl表达式结果为true时可以访问 |
| | | * anonymous | 匿名可以访问 |
| | | * denyAll | 用户不能访问 |
| | | * fullyAuthenticated | 用户完全认证可以访问(非remember-me下自动登录) |
| | | * hasAnyAuthority | 如果有参数,参数表示权限,则其中任何一个权限可以访问 |
| | | * hasAnyRole | 如果有参数,参数表示角色,则其中任何一个角色可以访问 |
| | | * hasAuthority | 如果有参数,参数表示权限,则其权限可以访问 |
| | | * hasIpAddress | 如果有参数,参数表示IP地址,如果用户IP和参数匹配,则可以访问 |
| | | * hasRole | 如果有参数,参数表示角色,则其角色可以访问 |
| | | * permitAll | 用户可以任意访问 |
| | | * rememberMe | 允许通过remember-me登录的用户访问 |
| | | * authenticated | 用户登录后可访问 |
| | | * anyRequest | 匹配所有请求路径 access | SpringEl表达式结果为true时可以访问 anonymous | |
| | | * 匿名可以访问 denyAll | 用户不能访问 fullyAuthenticated | 用户完全认证可以访问(非remember-me下自动登录) |
| | | * hasAnyAuthority | 如果有参数,参数表示权限,则其中任何一个权限可以访问 hasAnyRole | 如果有参数,参数表示角色,则其中任何一个角色可以访问 |
| | | * hasAuthority | 如果有参数,参数表示权限,则其权限可以访问 hasIpAddress | |
| | | * 如果有参数,参数表示IP地址,如果用户IP和参数匹配,则可以访问 hasRole | 如果有参数,参数表示角色,则其角色可以访问 permitAll |
| | | * | 用户可以任意访问 rememberMe | 允许通过remember-me登录的用户访问 authenticated | |
| | | * 用户登录后可访问 |
| | | */ |
| | | @Override |
| | | protected void configure(HttpSecurity httpSecurity) throws Exception |
| | | { |
| | | protected void configure(HttpSecurity httpSecurity) throws Exception { |
| | | // 注解标记允许匿名访问的url |
| | | ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = httpSecurity.authorizeRequests(); |
| | | permitAllUrl.getUrls().forEach(url -> registry.antMatchers(url).permitAll()); |
| | |
| | | // 过滤请求 |
| | | .authorizeRequests() |
| | | // 对于登录login 注册register 验证码captchaImage 允许匿名访问 |
| | | .antMatchers("/getPrivacyAgreement/{agreementType}","/applet/queryProtocolConfigByType","/applet/login","/login","/applet/queryProtocolConfigByType", "/register","/applet/getCode","/applet/loginCode","/applet/changepwd", "/captchaImage","/getCode","/loginCode","/operations/getBySingleNum/**", |
| | | "/user/getUserInfoByNumber/**","/genAccount","/loginPwd").permitAll() |
| | | .antMatchers("/getPrivacyAgreement/{agreementType}", |
| | | "/applet/queryProtocolConfigByType", "/applet/login", "/login", |
| | | "/applet/queryProtocolConfigByType", "/register", "/applet/getCode", |
| | | "/applet/loginCode", "/applet/changepwd", "/captchaImage", "/getCode", |
| | | "/loginCode", "/operations/getBySingleNum/**", |
| | | "/user/getUserInfoByNumber/**", "/genAccount", "/loginPwd", "/screen/**") |
| | | .permitAll() |
| | | //放行所有 |
| | | //.antMatchers("/*/**").permitAll() |
| | | // 静态资源,可匿名访问 |
| | | .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() |
| | | .antMatchers("/swagger-ui.html","/doc.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() |
| | | .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", |
| | | "/profile/**").permitAll() |
| | | .antMatchers("/swagger-ui.html", "/doc.html", "/swagger-resources/**", |
| | | "/webjars/**", "/*/api-docs", "/druid/**").permitAll() |
| | | // 除上面外的所有请求全部需要鉴权认证 |
| | | .anyRequest().authenticated() |
| | | .and() |
| | |
| | | // 添加Logout filter |
| | | httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); |
| | | // 添加JWT filter |
| | | httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); |
| | | httpSecurity.addFilterBefore(authenticationTokenFilter, |
| | | UsernamePasswordAuthenticationFilter.class); |
| | | // 添加CORS filter |
| | | httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class); |
| | | httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class); |
| | |
| | | * 强散列哈希加密实现 |
| | | */ |
| | | @Bean |
| | | public BCryptPasswordEncoder bCryptPasswordEncoder() |
| | | { |
| | | public BCryptPasswordEncoder bCryptPasswordEncoder() { |
| | | return new BCryptPasswordEncoder(); |
| | | } |
| | | |
| | |
| | | * 身份认证接口 |
| | | */ |
| | | @Override |
| | | protected void configure(AuthenticationManagerBuilder auth) throws Exception |
| | | { |
| | | protected void configure(AuthenticationManagerBuilder auth) throws Exception { |
| | | auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); |
| | | } |
| | | } |
| | |
| | | @TableField("field_id_str") |
| | | private String fieldIdStr; |
| | | |
| | | @TableField("max_score") |
| | | @ApiModelProperty(value = "最大分值") |
| | | private Double maxScore; |
| | | |
| | | @ApiModelProperty(value = "状态(0=展示 1=隐藏)") |
| | | @TableField("status") |
| | | private ShowStatusEnum status; |
| | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "最大分值") |
| | | private Double maxScore; |
| | | |
| | | @ApiModelProperty(value = "配置类型(1=风险等级设置 2=数据指标设置 3=形式指标设置)") |
| | | @TableField("type") |
| | | private DataScreenConfigEnum type; |
| | |
| | | @TableField("del_flag") |
| | | private String delFlag; |
| | | |
| | | @ApiModelProperty(value = "创建者") |
| | | @TableField(value = "create_by", fill = FieldFill.INSERT) |
| | | private String createBy; |
| | | // @ApiModelProperty(value = "创建者") |
| | | // @TableField(value = "create_by", fill = FieldFill.INSERT) |
| | | // private String createBy; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @TableField(value = "create_time", fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "更新者") |
| | | @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE) |
| | | private String updateBy; |
| | | // @ApiModelProperty(value = "更新者") |
| | | // @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE) |
| | | // private String updateBy; |
| | | |
| | | @ApiModelProperty(value = "更新时间") |
| | | @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) |
| | |
| | | @ApiModelProperty(value = "字段id ", notes = "文本统计 和百分比统计的的字段id") |
| | | private String fieldIdStr; |
| | | |
| | | @ApiModelProperty(value = "最大分值") |
| | | private Double maxScore; |
| | | |
| | | @ApiModelProperty(value = "计算公式") |
| | | private List<CalculateItemDTO> calculateItemList; |
| | | |
| | |
| | | private CalculateTypeEnum calculateType; |
| | | |
| | | @ApiModelProperty(value = "字段id (多个id使用 ',' 拼接)") |
| | | @NotBlank(message = "字段id不能为空") |
| | | private String fieldIdStr; |
| | | |
| | | @ApiModelProperty(value = "最大分值") |
| | | private Double maxScore; |
| | | |
| | | @ApiModelProperty(value = "计算公式", notes = "计算类型为数字计算,配置内容使用该字段接收;公式中字段的格式为:field_字段id,e.g:field_1,field_2等。") |
| | | private List<CalculateItemDTO> calculateItemList; |
| | | |
| | |
| | | @ApiModelProperty(value = "配置类型子类型(1=指标一 2=指标二 3=指标三 4=指标四)") |
| | | private SubTypeEnum subType; |
| | | |
| | | @ApiModelProperty(value = "最大分值") |
| | | private Double maxScore; |
| | | |
| | | @ApiModelProperty(value = "得分计算规则") |
| | | private List<CalculateItemDTO> calculateItemList; |
| | | |
New file |
| | |
| | | package com.ruoyi.system.handler; |
| | | |
| | | import com.alibaba.excel.enums.CellDataTypeEnum; |
| | | import com.alibaba.excel.metadata.Head; |
| | | import com.alibaba.excel.metadata.data.WriteCellData; |
| | | import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; |
| | | import com.alibaba.excel.write.style.column.AbstractColumnWidthStyleStrategy; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | |
| | | /** |
| | | * @author jamin |
| | | * @date 2020/7/29 11:28 设置自适应列宽 |
| | | */ |
| | | public class CustomCellWriteHandler extends AbstractColumnWidthStyleStrategy { |
| | | |
| | | private Map<Integer, Map<Integer, Integer>> CACHE = new HashMap<>(); |
| | | |
| | | @Override |
| | | protected void setColumnWidth(WriteSheetHolder writeSheetHolder, |
| | | List<WriteCellData<?>> cellDataList, Cell cell, Head head, Integer relativeRowIndex, |
| | | Boolean isHead) { |
| | | boolean needSetWidth = isHead || !CollectionUtils.isEmpty(cellDataList); |
| | | if (needSetWidth) { |
| | | Map<Integer, Integer> maxColumnWidthMap = CACHE.get(writeSheetHolder.getSheetNo()); |
| | | if (maxColumnWidthMap == null) { |
| | | maxColumnWidthMap = new HashMap<>(); |
| | | CACHE.put(writeSheetHolder.getSheetNo(), maxColumnWidthMap); |
| | | } |
| | | |
| | | Integer columnWidth = this.dataLength(cellDataList, cell, isHead); |
| | | if (columnWidth >= 0) { |
| | | if (columnWidth > 255) { |
| | | columnWidth = 255; |
| | | } |
| | | |
| | | Integer maxColumnWidth = maxColumnWidthMap.get(cell.getColumnIndex()); |
| | | if (maxColumnWidth == null || columnWidth > maxColumnWidth) { |
| | | maxColumnWidthMap.put(cell.getColumnIndex(), columnWidth); |
| | | writeSheetHolder.getSheet() |
| | | .setColumnWidth(cell.getColumnIndex(), columnWidth * 256); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Integer dataLength(List<WriteCellData<?>> cellDataList, Cell cell, Boolean isHead) { |
| | | if (isHead) { |
| | | return cell.getStringCellValue().getBytes().length; |
| | | } else { |
| | | WriteCellData cellData = cellDataList.get(0); |
| | | CellDataTypeEnum type = cellData.getType(); |
| | | if (type == null) { |
| | | return -1; |
| | | } else { |
| | | switch (type) { |
| | | case STRING: |
| | | return cellData.getStringValue().getBytes().length; |
| | | case BOOLEAN: |
| | | return cellData.getBooleanValue().toString().getBytes().length; |
| | | case NUMBER: |
| | | return cellData.getNumberValue().toString().getBytes().length; |
| | | default: |
| | | return -1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.handler; |
| | | |
| | | import com.alibaba.excel.write.handler.SheetWriteHandler; |
| | | import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; |
| | | import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder; |
| | | import java.util.Map; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.ss.usermodel.DataValidation; |
| | | import org.apache.poi.ss.usermodel.DataValidationConstraint; |
| | | import org.apache.poi.ss.usermodel.DataValidationHelper; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.util.CellRangeAddressList; |
| | | |
| | | @Slf4j |
| | | public class TitleHandler implements SheetWriteHandler { |
| | | |
| | | /** |
| | | * 下拉框值 |
| | | */ |
| | | private Map<Integer, String[]> dropDownMap; |
| | | |
| | | /** |
| | | * 多少行有下拉 |
| | | */ |
| | | private final static Integer rowSize = 200; |
| | | |
| | | public TitleHandler(Map<Integer, String[]> dropDownMap) { |
| | | this.dropDownMap = dropDownMap; |
| | | } |
| | | |
| | | @Override |
| | | public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, |
| | | WriteSheetHolder writeSheetHolder) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, |
| | | WriteSheetHolder writeSheetHolder) { |
| | | Sheet sheet = writeSheetHolder.getSheet(); |
| | | DataValidationHelper helper = sheet.getDataValidationHelper(); |
| | | |
| | | dropDownMap.forEach((celIndex, strings) -> { |
| | | // 区间设置 |
| | | CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(1, rowSize, |
| | | celIndex, celIndex); |
| | | // 下拉内容 |
| | | DataValidationConstraint constraint = helper.createExplicitListConstraint(strings); |
| | | DataValidation dataValidation = helper.createValidation(constraint, |
| | | cellRangeAddressList); |
| | | sheet.addValidationData(dataValidation); |
| | | }); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.collect.Lists; |
| | | import com.ruoyi.common.enums.CalculateTypeEnum; |
| | | import com.ruoyi.common.enums.DataScreenConfigEnum; |
| | | import com.ruoyi.common.enums.FieldInputTypeEnum; |
| | | import com.ruoyi.common.enums.FieldTypeEnum; |
| | | import com.ruoyi.common.enums.ReportingStatusEnum; |
| | |
| | | import com.ruoyi.system.domain.TbBasicDataConfig; |
| | | import com.ruoyi.system.domain.TbBasicDataConfigDetail; |
| | | import com.ruoyi.system.domain.TbBasicDataField; |
| | | import com.ruoyi.system.domain.TbDataScreenScore; |
| | | import com.ruoyi.system.domain.TbField; |
| | | import com.ruoyi.system.domain.TbScore; |
| | | import com.ruoyi.system.dto.CalculateItemDTO; |
| | |
| | | import com.ruoyi.system.service.TbBasicDataConfigService; |
| | | import com.ruoyi.system.service.TbBasicDataFieldService; |
| | | import com.ruoyi.system.service.TbBasicDataService; |
| | | import com.ruoyi.system.service.TbDataScreenConfigService; |
| | | import com.ruoyi.system.service.TbDataScreenScoreService; |
| | | import com.ruoyi.system.service.TbFieldService; |
| | | import com.ruoyi.system.service.TbScoreService; |
| | | import com.ruoyi.system.vo.DataScreenConfigVO; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.concurrent.CompletableFuture; |
| | | import java.util.stream.Collectors; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | |
| | | public TbBasicDataConfigService tbBasicDataConfigService; |
| | | public TbBasicDataConfigDetailService tbBasicDataConfigDetailService; |
| | | public TbScoreService tbScoreService; |
| | | public TbDataScreenScoreService tbDataScreenScoreService; |
| | | public TbDataScreenConfigService tbDataScreenConfigService; |
| | | |
| | | public BasicDataListener(TbBasicDataService tbBasicDataService, |
| | | TbFieldService tbFieldService, |
| | | String areaCode, TbBasicDataFieldService tbBasicDataFieldService, |
| | | TbBasicDataConfigService tbBasicDataConfigService, |
| | | TbBasicDataConfigDetailService tbBasicDataConfigDetailService, |
| | | TbScoreService tbScoreService) { |
| | | TbScoreService tbScoreService, TbDataScreenScoreService tbDataScreenScoreService, |
| | | TbDataScreenConfigService tbDataScreenConfigService) { |
| | | this.tbBasicDataService = tbBasicDataService; |
| | | this.tbFieldService = tbFieldService; |
| | | this.areaCode = areaCode; |
| | |
| | | this.tbBasicDataConfigService = tbBasicDataConfigService; |
| | | this.tbBasicDataConfigDetailService = tbBasicDataConfigDetailService; |
| | | this.tbScoreService = tbScoreService; |
| | | this.tbDataScreenConfigService = tbDataScreenConfigService; |
| | | this.tbDataScreenScoreService = tbDataScreenScoreService; |
| | | } |
| | | |
| | | @Override |
| | |
| | | tbBasicData.setStatus(ReportingStatusEnum.FILLED); |
| | | tbBasicDataService.updateById(tbBasicData); |
| | | log.info(String.format("%s导入基础数据成功!", dataMap.get(0))); |
| | | calculateScore(tbBasicData, fields); |
| | | CompletableFuture.runAsync(() -> { |
| | | calculateScore(tbBasicData, fields); |
| | | calculateScreenScore(tbBasicData, fields); |
| | | }); |
| | | } |
| | | |
| | | private void calculateScore(TbBasicData tbBasicData, List<TbBasicDataField> fields) { |
| | |
| | | String numberCalculateFormulaStr = calculateItemDTOS.stream() |
| | | .map(CalculateItemDTO::getContent).collect(Collectors.joining()); |
| | | double score = CalculateUtil.calculate(numberCalculateFormulaStr); |
| | | if (Objects.nonNull(item.getMaxScore()) && score > item.getMaxScore()) { |
| | | score = item.getMaxScore(); |
| | | } |
| | | TbScore tbScore = new TbScore(); |
| | | tbScore.setBasicDataId(tbBasicData.getId()); |
| | | tbScore.setScore(score); |
| | |
| | | if (CalculateTypeEnum.PERCENTAGE.equals( |
| | | textAndPercentage.getCalculateType())) { |
| | | for (Map.Entry<String, String> stringStringEntry : scoreMap.entrySet()) { |
| | | String[] split = stringStringEntry.getKey().split("-"); |
| | | String[] split = stringStringEntry.getKey().split("_"); |
| | | double v = Double.parseDouble( |
| | | textAndPercentageData.getFieldValue()); |
| | | double min = Double.parseDouble(split[0]); |
| | |
| | | tbScore.setScore( |
| | | Double.parseDouble(stringStringEntry.getValue())); |
| | | } |
| | | } |
| | | //如果都不匹配,得分为0 |
| | | if (Objects.isNull(tbScore.getScore())) { |
| | | tbScore.setScore(0D); |
| | | } |
| | | tbScore.setBasicDataId(tbBasicData.getId()); |
| | | tbScore.setBasicDataConfigId(textAndPercentage.getId()); |
| | |
| | | } |
| | | tbScoreService.saveBatch(scoreList); |
| | | } |
| | | |
| | | private void calculateScreenScore(TbBasicData tbBasicData, |
| | | List<TbBasicDataField> tbBasicDataFields) { |
| | | Map<Long, TbBasicDataField> basicDataFieldMap = tbBasicDataFields.stream() |
| | | .collect(Collectors.toMap(TbBasicDataField::getFieldId, e -> e)); |
| | | DataScreenConfigVO riskLevel = tbDataScreenConfigService.getRiskLevel(); |
| | | List<DataScreenConfigVO> dataIndicatorsConfig = tbDataScreenConfigService.getIndicatorsConfig( |
| | | DataScreenConfigEnum.DATA_INDICATORS); |
| | | List<DataScreenConfigVO> formalIndicatorsConfig = tbDataScreenConfigService.getIndicatorsConfig( |
| | | DataScreenConfigEnum.FORMAL_INDICATORS); |
| | | handleScoreCalculate(tbBasicData, riskLevel, basicDataFieldMap); |
| | | for (DataScreenConfigVO config : dataIndicatorsConfig) { |
| | | handleScoreCalculate(tbBasicData, config, basicDataFieldMap); |
| | | } |
| | | for (DataScreenConfigVO config : formalIndicatorsConfig) { |
| | | handleScoreCalculate(tbBasicData, config, basicDataFieldMap); |
| | | } |
| | | } |
| | | |
| | | private void handleScoreCalculate(TbBasicData tbBasicData, DataScreenConfigVO vo, |
| | | Map<Long, TbBasicDataField> basicDataFieldMap) { |
| | | TbDataScreenScore tbDataScreenScore = tbDataScreenScoreService.lambdaQuery() |
| | | .eq(TbDataScreenScore::getBasicDataId, tbBasicData.getId()).eq( |
| | | TbDataScreenScore::getDataScreenConfigId, vo.getId()).one(); |
| | | if (Objects.isNull(tbDataScreenScore)) { |
| | | tbDataScreenScore = new TbDataScreenScore(); |
| | | tbDataScreenScore.setDataScreenConfigId(vo.getId()); |
| | | tbDataScreenScore.setBasicDataId(tbBasicData.getId()); |
| | | tbDataScreenScore.setDeptAreaCode(tbBasicData.getDeptAreaCode()); |
| | | } |
| | | List<CalculateItemDTO> scoreCalculateList = vo.getScoreCalculateList(); |
| | | for (CalculateItemDTO item : scoreCalculateList) { |
| | | if (item.getValueType().equals(ValueTypeEnum.FIELD)) { |
| | | TbBasicDataField basicDataField = basicDataFieldMap.get( |
| | | Long.valueOf(item.getContent())); |
| | | if (Objects.nonNull(basicDataField)) { |
| | | item.setContent(basicDataField.getFieldValue()); |
| | | } |
| | | } |
| | | } |
| | | String calculateFormulaStr = scoreCalculateList.stream() |
| | | .map(CalculateItemDTO::getContent).collect(Collectors.joining()); |
| | | double score = CalculateUtil.calculate(calculateFormulaStr); |
| | | if (vo.getType().equals(DataScreenConfigEnum.FORMAL_INDICATORS)) { |
| | | if (Objects.nonNull(vo.getMaxScore()) && score > vo.getMaxScore()) { |
| | | score = vo.getMaxScore(); |
| | | } |
| | | } |
| | | tbDataScreenScore.setScore(score); |
| | | if (vo.getType().equals(DataScreenConfigEnum.DATA_INDICATORS)) { |
| | | List<CalculateItemDTO> rateCalculateList = vo.getRateCalculateList(); |
| | | for (CalculateItemDTO calculateItemDTO : rateCalculateList) { |
| | | if (calculateItemDTO.getValueType().equals(ValueTypeEnum.FIELD)) { |
| | | TbBasicDataField basicDataField = basicDataFieldMap.get( |
| | | Long.valueOf(calculateItemDTO.getContent())); |
| | | if (Objects.nonNull(basicDataField)) { |
| | | calculateItemDTO.setContent(basicDataField.getFieldValue()); |
| | | } |
| | | } |
| | | } |
| | | String calculateRateFormulaStr = rateCalculateList.stream() |
| | | .map(CalculateItemDTO::getContent).collect(Collectors.joining()); |
| | | double scoreRate = CalculateUtil.calculate(calculateRateFormulaStr); |
| | | tbDataScreenScore.setScoreRate(scoreRate); |
| | | } |
| | | tbDataScreenScoreService.saveOrUpdate(tbDataScreenScore); |
| | | } |
| | | } |
| | |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.alibaba.excel.util.ListUtils; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.collect.Lists; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.CalculateTypeEnum; |
| | | import com.ruoyi.common.enums.DataScreenConfigEnum; |
| | | import com.ruoyi.common.enums.FieldInputTypeEnum; |
| | | import com.ruoyi.common.enums.FieldTypeEnum; |
| | | import com.ruoyi.common.enums.ReportingStatusEnum; |
| | | import com.ruoyi.common.enums.ShowStatusEnum; |
| | | import com.ruoyi.common.enums.UserTypeEnum; |
| | | import com.ruoyi.common.enums.ValueTypeEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.CalculateUtil; |
| | | import com.ruoyi.common.utils.CollUtils; |
| | |
| | | import com.ruoyi.system.domain.TbBasicDataConfig; |
| | | import com.ruoyi.system.domain.TbBasicDataConfigDetail; |
| | | import com.ruoyi.system.domain.TbBasicDataField; |
| | | import com.ruoyi.system.domain.TbDataScreenScore; |
| | | import com.ruoyi.system.domain.TbField; |
| | | import com.ruoyi.system.domain.TbScore; |
| | | import com.ruoyi.system.dto.CalculateItemDTO; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.TbBasicDataConfigDetailService; |
| | | import com.ruoyi.system.service.TbBasicDataConfigService; |
| | | import com.ruoyi.system.service.TbBasicDataFieldService; |
| | | import com.ruoyi.system.service.TbBasicDataService; |
| | | import com.ruoyi.system.service.TbDataScreenConfigService; |
| | | import com.ruoyi.system.service.TbDataScreenScoreService; |
| | | import com.ruoyi.system.service.TbFieldService; |
| | | import com.ruoyi.system.service.TbScoreService; |
| | | import com.ruoyi.system.vo.DataScreenConfigVO; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.concurrent.CompletableFuture; |
| | | import java.util.stream.Collectors; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | |
| | | public TbScoreService tbScoreService; |
| | | public ISysUserService sysUserService; |
| | | public String quarter; |
| | | public TbDataScreenScoreService tbDataScreenScoreService; |
| | | public TbDataScreenConfigService tbDataScreenConfigService; |
| | | private List<Map<Integer, String>> cachedDataList = ListUtils.newArrayListWithExpectedSize( |
| | | BATCH_COUNT); |
| | | |
| | |
| | | TbBasicDataFieldService tbBasicDataFieldService, |
| | | TbBasicDataConfigService tbBasicDataConfigService, |
| | | TbBasicDataConfigDetailService tbBasicDataConfigDetailService, |
| | | TbScoreService tbScoreService, ISysUserService sysUserService, String quarter) { |
| | | TbScoreService tbScoreService, ISysUserService sysUserService, String quarter, |
| | | TbDataScreenScoreService tbDataScreenScoreService, |
| | | TbDataScreenConfigService tbDataScreenConfigService) { |
| | | this.tbBasicDataService = tbBasicDataService; |
| | | this.tbFieldService = tbFieldService; |
| | | this.tbBasicDataFieldService = tbBasicDataFieldService; |
| | |
| | | this.tbScoreService = tbScoreService; |
| | | this.sysUserService = sysUserService; |
| | | this.quarter = quarter; |
| | | this.tbDataScreenConfigService = tbDataScreenConfigService; |
| | | this.tbDataScreenScoreService = tbDataScreenScoreService; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext context) { |
| | | try { |
| | | List<TbBasicData> tbBasicDataList = saveData(); |
| | | calculateScore(tbBasicDataList); |
| | | saveData(); |
| | | } catch (Exception e) { |
| | | if (e instanceof ServiceException) { |
| | | throw new ServiceException(e.getMessage()); |
| | |
| | | /** |
| | | * 加上存储数据库 |
| | | */ |
| | | private List<TbBasicData> saveData() { |
| | | List<TbBasicData> tbBasicDataList = new ArrayList<>(); |
| | | private void saveData() { |
| | | // 查询需要填写的动态字段 |
| | | List<TbField> fieldList = |
| | | tbFieldService.lambdaQuery().eq(TbField::getStatus, ShowStatusEnum.SHOW).list(); |
| | |
| | | tbBasicDataFieldService.saveBatch(fields); |
| | | tbBasicData.setStatus(ReportingStatusEnum.FILLED); |
| | | tbBasicDataService.updateById(tbBasicData); |
| | | tbBasicDataList.add(tbBasicData); |
| | | CompletableFuture.runAsync(() -> { |
| | | calculateScore(tbBasicData, fields); |
| | | calculateScreenScore(tbBasicData, fields); |
| | | }); |
| | | } |
| | | log.info(String.format("%s导入基础数据成功!", JSON.toJSONString(dataMapList))); |
| | | return tbBasicDataList; |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 计算得分 |
| | | * |
| | | * @param tbBasicDataList 基础数据集合 |
| | | * @param tbBasicData |
| | | * @param fields |
| | | */ |
| | | private void calculateScore(List<TbBasicData> tbBasicDataList) { |
| | | private void calculateScore(TbBasicData tbBasicData, List<TbBasicDataField> fields) { |
| | | List<TbScore> scoreList = new ArrayList<>(); |
| | | for (TbBasicData tbBasicData : tbBasicDataList) { |
| | | //计算得分 |
| | | List<TbBasicDataConfig> list = tbBasicDataConfigService.lambdaQuery() |
| | | .eq(TbBasicDataConfig::getStatus, ShowStatusEnum.SHOW).list(); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | throw new ServiceException("计算得分失败,平台未配置得分计算规则"); |
| | | } |
| | | List<TbBasicDataConfig> numCalculates = list.stream() |
| | | .filter(item -> CalculateTypeEnum.NUMBER.equals(item.getCalculateType())) |
| | | .collect(Collectors.toList()); |
| | | List<TbBasicDataConfig> textAndPercentages = list.stream() |
| | | .filter(item -> !CalculateTypeEnum.NUMBER.equals(item.getCalculateType())) |
| | | .collect(Collectors.toList()); |
| | | tbScoreService.remove( |
| | | new LambdaQueryWrapper<TbScore>().eq(TbScore::getBasicDataId, |
| | | tbBasicData.getId())); |
| | | if (CollUtils.isNotEmpty(numCalculates)) { |
| | | for (TbBasicDataConfig item : numCalculates) { |
| | | Map<String, Object> valueMap = new HashMap<>(); |
| | | String numberCalculateFormula = item.getNumberCalculateFormula(); |
| | | Map<String, Integer> fieldsAndValue = CalculateUtil.getFieldsAndValue( |
| | | numberCalculateFormula); |
| | | for (Map.Entry<String, Integer> stringIntegerEntry : fieldsAndValue.entrySet()) { |
| | | Optional<TbBasicDataField> tbBasicDataField = tbBasicDataFieldService.lambdaQuery() |
| | | .eq(TbBasicDataField::getBasicDataId, tbBasicData.getId()) |
| | | .eq(TbBasicDataField::getFieldId, stringIntegerEntry.getValue()) |
| | | .oneOpt(); |
| | | tbBasicDataField.ifPresent( |
| | | basicDataField -> valueMap.put(stringIntegerEntry.getKey(), |
| | | basicDataField.getFieldValue())); |
| | | //计算得分 |
| | | List<TbBasicDataConfig> list = tbBasicDataConfigService.lambdaQuery() |
| | | .eq(TbBasicDataConfig::getStatus, ShowStatusEnum.SHOW).list(); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | throw new ServiceException("计算得分失败,平台未配置得分计算规则"); |
| | | } |
| | | List<TbBasicDataConfig> numCalculates = list.stream() |
| | | .filter(item -> CalculateTypeEnum.NUMBER.equals(item.getCalculateType())) |
| | | .collect(Collectors.toList()); |
| | | List<TbBasicDataConfig> textAndPercentages = list.stream() |
| | | .filter(item -> !CalculateTypeEnum.NUMBER.equals(item.getCalculateType())) |
| | | .collect(Collectors.toList()); |
| | | tbScoreService.remove( |
| | | new LambdaQueryWrapper<TbScore>().eq(TbScore::getBasicDataId, tbBasicData.getId())); |
| | | Map<Long, TbBasicDataField> basicDataFieldMap = fields.stream() |
| | | .collect(Collectors.toMap(TbBasicDataField::getFieldId, e -> e)); |
| | | if (CollUtils.isNotEmpty(numCalculates)) { |
| | | for (TbBasicDataConfig item : numCalculates) { |
| | | String numberCalculateFormula = item.getNumberCalculateFormula(); |
| | | List<CalculateItemDTO> calculateItemDTOS = JSONArray.parseArray( |
| | | numberCalculateFormula, |
| | | CalculateItemDTO.class); |
| | | for (CalculateItemDTO dto : calculateItemDTOS) { |
| | | if (ValueTypeEnum.FIELD.equals(dto.getValueType())) { |
| | | TbBasicDataField tbBasicDataField = basicDataFieldMap.get( |
| | | Long.valueOf(dto.getContent())); |
| | | if (Objects.nonNull(tbBasicDataField)) { |
| | | dto.setContent(tbBasicDataField.getFieldValue()); |
| | | } |
| | | } |
| | | double score = CalculateUtil.calculate(numberCalculateFormula, valueMap); |
| | | TbScore tbScore = new TbScore(); |
| | | tbScore.setBasicDataId(tbBasicData.getId()); |
| | | tbScore.setScore(score); |
| | | tbScore.setBasicDataConfigId(item.getId()); |
| | | scoreList.add(tbScore); |
| | | } |
| | | String numberCalculateFormulaStr = calculateItemDTOS.stream() |
| | | .map(CalculateItemDTO::getContent).collect(Collectors.joining()); |
| | | double score = CalculateUtil.calculate(numberCalculateFormulaStr); |
| | | if (Objects.nonNull(item.getMaxScore()) && score > item.getMaxScore()) { |
| | | score = item.getMaxScore(); |
| | | } |
| | | TbScore tbScore = new TbScore(); |
| | | tbScore.setBasicDataId(tbBasicData.getId()); |
| | | tbScore.setScore(score); |
| | | tbScore.setBasicDataConfigId(item.getId()); |
| | | scoreList.add(tbScore); |
| | | } |
| | | if (CollUtils.isNotEmpty(textAndPercentages)) { |
| | | for (TbBasicDataConfig textAndPercentage : textAndPercentages) { |
| | | TbScore tbScore = new TbScore(); |
| | | List<TbBasicDataConfigDetail> details = tbBasicDataConfigDetailService.lambdaQuery() |
| | | .eq(TbBasicDataConfigDetail::getBasicDataConfigId, |
| | | textAndPercentage.getId()) |
| | | .list(); |
| | | Map<String, String> scoreMap = details.stream().collect( |
| | | Collectors.toMap(TbBasicDataConfigDetail::getKey, |
| | | TbBasicDataConfigDetail::getValue)); |
| | | if (CollectionUtils.isNotEmpty(details)) { |
| | | Optional<TbBasicDataField> tbBasicDataFieldOptional = tbBasicDataFieldService.lambdaQuery() |
| | | .eq(TbBasicDataField::getBasicDataId, tbBasicData.getId()) |
| | | .eq(TbBasicDataField::getFieldId, textAndPercentage.getFieldIdStr()) |
| | | .oneOpt(); |
| | | if (tbBasicDataFieldOptional.isPresent()) { |
| | | TbBasicDataField tbBasicDataField = tbBasicDataFieldOptional.get(); |
| | | if (CalculateTypeEnum.TEXT.equals( |
| | | textAndPercentage.getCalculateType())) { |
| | | String score = scoreMap.get(tbBasicDataField.getFieldValue()); |
| | | tbScore.setBasicDataId(tbBasicData.getId()); |
| | | tbScore.setScore(Double.parseDouble(score)); |
| | | tbScore.setBasicDataConfigId(textAndPercentage.getId()); |
| | | scoreList.add(tbScore); |
| | | } |
| | | if (CalculateTypeEnum.PERCENTAGE.equals( |
| | | textAndPercentage.getCalculateType())) { |
| | | for (Map.Entry<String, String> stringStringEntry : scoreMap.entrySet()) { |
| | | String[] split = stringStringEntry.getKey().split("-"); |
| | | double v = Double.parseDouble(tbBasicDataField.getFieldValue()); |
| | | double min = Double.parseDouble(split[0]); |
| | | double max = Double.parseDouble(split[1]); |
| | | if (v >= min && v <= max) { |
| | | tbScore.setScore( |
| | | Double.parseDouble(stringStringEntry.getValue())); |
| | | } |
| | | } |
| | | if (CollUtils.isNotEmpty(textAndPercentages)) { |
| | | for (TbBasicDataConfig textAndPercentage : textAndPercentages) { |
| | | TbScore tbScore = new TbScore(); |
| | | List<TbBasicDataConfigDetail> details = tbBasicDataConfigDetailService.lambdaQuery() |
| | | .eq(TbBasicDataConfigDetail::getBasicDataConfigId, |
| | | textAndPercentage.getId()) |
| | | .list(); |
| | | Map<String, String> scoreMap = details.stream().collect( |
| | | Collectors.toMap(TbBasicDataConfigDetail::getKey, |
| | | TbBasicDataConfigDetail::getValue)); |
| | | if (CollectionUtils.isNotEmpty(details)) { |
| | | TbBasicDataField textAndPercentageData = basicDataFieldMap.get( |
| | | Long.valueOf(textAndPercentage.getFieldIdStr())); |
| | | if (Objects.nonNull(textAndPercentageData)) { |
| | | if (CalculateTypeEnum.TEXT.equals(textAndPercentage.getCalculateType())) { |
| | | String score = scoreMap.get(textAndPercentageData.getFieldValue()); |
| | | tbScore.setBasicDataId(tbBasicData.getId()); |
| | | tbScore.setScore(Double.parseDouble(score)); |
| | | tbScore.setBasicDataConfigId(textAndPercentage.getId()); |
| | | scoreList.add(tbScore); |
| | | } |
| | | if (CalculateTypeEnum.PERCENTAGE.equals( |
| | | textAndPercentage.getCalculateType())) { |
| | | for (Map.Entry<String, String> stringStringEntry : scoreMap.entrySet()) { |
| | | String[] split = stringStringEntry.getKey().split("_"); |
| | | double v = Double.parseDouble( |
| | | textAndPercentageData.getFieldValue()); |
| | | double min = Double.parseDouble(split[0]); |
| | | double max = Double.parseDouble(split[1]); |
| | | if (v >= min && v <= max) { |
| | | tbScore.setScore( |
| | | Double.parseDouble(stringStringEntry.getValue())); |
| | | } |
| | | tbScore.setBasicDataId(tbBasicData.getId()); |
| | | tbScore.setBasicDataConfigId(textAndPercentage.getId()); |
| | | scoreList.add(tbScore); |
| | | } |
| | | //如果都不匹配,得分为0 |
| | | if (Objects.isNull(tbScore.getScore())) { |
| | | tbScore.setScore(0D); |
| | | } |
| | | tbScore.setBasicDataId(tbBasicData.getId()); |
| | | tbScore.setBasicDataConfigId(textAndPercentage.getId()); |
| | | scoreList.add(tbScore); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | tbScoreService.saveBatch(scoreList); |
| | | log.info(String.format("基础数据%s计算得分成功!", JSON.toJSONString(tbBasicDataList))); |
| | | } |
| | | |
| | | private void calculateScreenScore(TbBasicData tbBasicData, |
| | | List<TbBasicDataField> tbBasicDataFields) { |
| | | Map<Long, TbBasicDataField> basicDataFieldMap = tbBasicDataFields.stream() |
| | | .collect(Collectors.toMap(TbBasicDataField::getFieldId, e -> e)); |
| | | DataScreenConfigVO riskLevel = tbDataScreenConfigService.getRiskLevel(); |
| | | List<DataScreenConfigVO> dataIndicatorsConfig = tbDataScreenConfigService.getIndicatorsConfig( |
| | | DataScreenConfigEnum.DATA_INDICATORS); |
| | | List<DataScreenConfigVO> formalIndicatorsConfig = tbDataScreenConfigService.getIndicatorsConfig( |
| | | DataScreenConfigEnum.FORMAL_INDICATORS); |
| | | handleScoreCalculate(tbBasicData, riskLevel, basicDataFieldMap); |
| | | for (DataScreenConfigVO config : dataIndicatorsConfig) { |
| | | handleScoreCalculate(tbBasicData, config, basicDataFieldMap); |
| | | } |
| | | for (DataScreenConfigVO config : formalIndicatorsConfig) { |
| | | handleScoreCalculate(tbBasicData, config, basicDataFieldMap); |
| | | } |
| | | } |
| | | |
| | | private void handleScoreCalculate(TbBasicData tbBasicData, DataScreenConfigVO vo, |
| | | Map<Long, TbBasicDataField> basicDataFieldMap) { |
| | | TbDataScreenScore tbDataScreenScore = tbDataScreenScoreService.lambdaQuery() |
| | | .eq(TbDataScreenScore::getBasicDataId, tbBasicData.getId()).eq( |
| | | TbDataScreenScore::getDataScreenConfigId, vo.getId()).one(); |
| | | if (Objects.isNull(tbDataScreenScore)) { |
| | | tbDataScreenScore = new TbDataScreenScore(); |
| | | tbDataScreenScore.setDataScreenConfigId(vo.getId()); |
| | | tbDataScreenScore.setBasicDataId(tbBasicData.getId()); |
| | | tbDataScreenScore.setDeptAreaCode(tbBasicData.getDeptAreaCode()); |
| | | } |
| | | List<CalculateItemDTO> scoreCalculateList = vo.getScoreCalculateList(); |
| | | for (CalculateItemDTO item : scoreCalculateList) { |
| | | if (item.getValueType().equals(ValueTypeEnum.FIELD)) { |
| | | TbBasicDataField basicDataField = basicDataFieldMap.get( |
| | | Long.valueOf(item.getContent())); |
| | | if (Objects.nonNull(basicDataField)) { |
| | | item.setContent(basicDataField.getFieldValue()); |
| | | } |
| | | } |
| | | } |
| | | String calculateFormulaStr = scoreCalculateList.stream() |
| | | .map(CalculateItemDTO::getContent).collect(Collectors.joining()); |
| | | double score = CalculateUtil.calculate(calculateFormulaStr); |
| | | if (vo.getType().equals(DataScreenConfigEnum.FORMAL_INDICATORS)) { |
| | | if (Objects.nonNull(vo.getMaxScore()) && score > vo.getMaxScore()) { |
| | | score = vo.getMaxScore(); |
| | | } |
| | | } |
| | | tbDataScreenScore.setScore(score); |
| | | if (vo.getType().equals(DataScreenConfigEnum.DATA_INDICATORS)) { |
| | | List<CalculateItemDTO> rateCalculateList = vo.getRateCalculateList(); |
| | | for (CalculateItemDTO calculateItemDTO : rateCalculateList) { |
| | | if (calculateItemDTO.getValueType().equals(ValueTypeEnum.FIELD)) { |
| | | TbBasicDataField basicDataField = basicDataFieldMap.get( |
| | | Long.valueOf(calculateItemDTO.getContent())); |
| | | if (Objects.nonNull(basicDataField)) { |
| | | calculateItemDTO.setContent(basicDataField.getFieldValue()); |
| | | } |
| | | } |
| | | } |
| | | String calculateRateFormulaStr = rateCalculateList.stream() |
| | | .map(CalculateItemDTO::getContent).collect(Collectors.joining()); |
| | | double scoreRate = CalculateUtil.calculate(calculateRateFormulaStr); |
| | | tbDataScreenScore.setScoreRate(scoreRate); |
| | | } |
| | | tbDataScreenScoreService.saveOrUpdate(tbDataScreenScore); |
| | | } |
| | | } |
| | |
| | | |
| | | List<SysUser> queryList(); |
| | | |
| | | Integer selectCount(@Param("status") Integer status); |
| | | Integer selectCountByStatus(@Param("status") Integer status); |
| | | |
| | | /** |
| | | * 获取用户列表 |
| | |
| | | import com.ruoyi.system.domain.TbBasicData; |
| | | import com.ruoyi.system.query.CurrentFieldsQuery; |
| | | import com.ruoyi.system.vo.CurrentFieldsVO; |
| | | import com.ruoyi.system.vo.FieldAndScoreDataVO; |
| | | import com.ruoyi.system.vo.TransferPaymentScaleVO; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public interface TbBasicDataMapper extends BaseMapper<TbBasicData> { |
| | | |
| | | Page<CurrentFieldsVO> fieldsStatics(@Param("page") Page<CurrentFieldsVO> page, @Param("dto") CurrentFieldsQuery dto); |
| | | Page<CurrentFieldsVO> fieldsStatics(@Param("page") Page<CurrentFieldsVO> page, |
| | | @Param("dto") CurrentFieldsQuery dto); |
| | | |
| | | Page<TransferPaymentScaleVO> transferPaymentScalePage( |
| | | @Param("page") Page<TransferPaymentScaleVO> page, |
| | | @Param("quarter") String quarter); |
| | | |
| | | List<FieldAndScoreDataVO> selectBasicDataFieldsConfig(@Param("areaCode") String areaCode, |
| | | @Param("nowQuarter") String nowQuarter); |
| | | } |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.enums.AreaLevelEnum; |
| | | import com.ruoyi.common.enums.DataScreenConfigEnum; |
| | | import com.ruoyi.common.enums.SubTypeEnum; |
| | | import com.ruoyi.system.domain.TbDataScreenScore; |
| | | import com.ruoyi.system.vo.DataScreenScoreVO; |
| | | import com.ruoyi.system.vo.RiskMapVO; |
| | | import com.ruoyi.system.vo.RiskRankingVO; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TbDataScreenScoreMapper extends BaseMapper<TbDataScreenScore> { |
| | | |
| | | List<RiskMapVO> queryScore4Map(@Param("nowQuarter") String nowQuarter, |
| | | @Param("dataScreenConfigId") Long dataScreenConfigId); |
| | | |
| | | List<RiskRankingVO> queryRiskRanking(@Param("dataScreenConfigId") Long dataScreenConfigId, |
| | | @Param("nowQuarter") String nowQuarter, |
| | | @Param("areaTypeEnum") AreaLevelEnum areaLevelEnum); |
| | | |
| | | List<TbDataScreenScore> selectRiskByQuarter(@Param("nowQuarter") String nowQuarter, |
| | | @Param("dataScreenConfigId") Long dataScreenConfigId, |
| | | @Param("areaCode") String areaCode); |
| | | |
| | | List<DataScreenScoreVO> queryScoreByAreaAndYear(@Param("areaCode") String areaCode, |
| | | @Param("dataScreenConfigId") Long dataScreenConfigId, |
| | | @Param("yearType") Integer yearType); |
| | | |
| | | List<DataScreenScoreVO> selectIndicators(@Param("areaCode") String areaCode, |
| | | @Param("nowQuarter") String nowQuarter, |
| | | @Param("dataScreenConfigEnum") DataScreenConfigEnum dataScreenConfigEnum, |
| | | @Param("yearType") Integer yearType); |
| | | |
| | | Integer getRankByScore(@Param("score") Double score, |
| | | @Param("subType") SubTypeEnum subType, @Param("areaCode") String areaCode, |
| | | @Param("nowQuarter") String nowQuarter, |
| | | @Param("dataScreenConfigEnum") DataScreenConfigEnum dataScreenConfigEnum); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.system.domain.TbScore; |
| | | import com.ruoyi.system.query.CalculateDetailQuery; |
| | | import com.ruoyi.system.query.DeptCalculateDetailQuery; |
| | | import com.ruoyi.system.query.ScoreCalculateDetailQuery; |
| | | import com.ruoyi.system.query.ScoreQuery; |
| | | import com.ruoyi.system.vo.DeptCalculateDetailVO; |
| | | import com.ruoyi.system.vo.ScoreDetailVO; |
| | | import com.ruoyi.system.vo.ScoreRankVO; |
| | | import com.ruoyi.system.vo.ScoreVO; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | |
| | | |
| | | Page<ScoreVO> pageScore(@Param("query") ScoreQuery query, @Param("page") Page<ScoreVO> page); |
| | | |
| | | Page<ScoreDetailVO> scoreCalculateDetail(@Param("query") ScoreCalculateDetailQuery query, @Param("page") Page<ScoreDetailVO> page); |
| | | Page<ScoreDetailVO> scoreCalculateDetail(@Param("query") ScoreCalculateDetailQuery query, |
| | | @Param("page") Page<ScoreDetailVO> page); |
| | | |
| | | List<ScoreRankVO> queryTotalScoreList(); |
| | | |
| | | ScoreRankVO queryRankAndScoreByAreaCode(@Param("areaCode") String areaCode); |
| | | |
| | | List<DeptCalculateDetailVO> deptCalculateDetail(@Param("query") DeptCalculateDetailQuery query, |
| | | @Param("nowQuarter") String nowQuarter); |
| | | |
| | | Page<ScoreDetailVO> fieldsDetail(@Param("query") CalculateDetailQuery query, |
| | | @Param("page") Page<ScoreDetailVO> page, @Param("countyList") List<String> countyList); |
| | | } |
| | |
| | | private static final long serialVersionUID = -6505569126273148383L; |
| | | |
| | | @ApiModelProperty(value = "类型名称") |
| | | private String basicDataConfigName; |
| | | private String typeName; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private ShowStatusEnum status; |
New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/17 |
| | | */ |
| | | @Data |
| | | @ApiModel("部门得分计算查询对象") |
| | | public class CalculateDetailQuery extends BasePage { |
| | | |
| | | private static final long serialVersionUID = -1356805221869994937L; |
| | | |
| | | @ApiModelProperty(value = "计算类型id") |
| | | @NotNull(message = "计算类型id不能为空") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("市级区划代码") |
| | | @NotBlank(message = "市级区划代码不能为空") |
| | | private String cityAreaCode; |
| | | |
| | | @ApiModelProperty(value = "部门区划代码") |
| | | private String areaCode; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/17 |
| | | */ |
| | | @Data |
| | | @ApiModel("部门得分计算查询对象") |
| | | public class DeptCalculateDetailQuery { |
| | | |
| | | @ApiModelProperty("部门区划代码") |
| | | private String areaCode; |
| | | |
| | | @ApiModelProperty("计算类型分类id") |
| | | @NotNull(message = "计算类型分类id不能为空") |
| | | private Long basicDataCategoryId; |
| | | } |
| | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "部门名称") |
| | | private String areaName; |
| | | private String areaCode; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/16 |
| | | */ |
| | | @Data |
| | | @ApiModel("转移支付规模查询对象") |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class TransferPaymentScaleQuery extends BasePage { |
| | | |
| | | private static final long serialVersionUID = 2207211510307469127L; |
| | | @ApiModelProperty("年份") |
| | | private String quarter; |
| | | } |
| | |
| | | |
| | | List<SysUser> queryList(); |
| | | |
| | | Integer selectCount(Integer status); |
| | | Integer selectCountByStatus(Integer status); |
| | | |
| | | /** |
| | | * 获取用户列表 |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | import com.ruoyi.system.vo.CurrentFieldsAllVO; |
| | | import com.ruoyi.system.vo.CurrentFieldsDetailVO; |
| | | import com.ruoyi.system.vo.CurrentFieldsVO; |
| | | import com.ruoyi.system.vo.FieldAndScoreDataVO; |
| | | import com.ruoyi.system.vo.ScoreCalculateVO; |
| | | import com.ruoyi.system.vo.ScoreVO; |
| | | import com.ruoyi.system.vo.TransferPaymentScaleVO; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | void importData(MultipartFile file, String quarter) throws IOException; |
| | | |
| | | void exportData(List<String> quarterList) throws Exception; |
| | | |
| | | Page<TransferPaymentScaleVO> transferPaymentScalePage(Page<TransferPaymentScaleVO> page, |
| | | String quarter); |
| | | |
| | | List<FieldAndScoreDataVO> selectBasicDataFieldsConfig(String areaCode, String nowQuarter); |
| | | } |
| | |
| | | |
| | | List<DataScreenConfigVO> getIndicatorsConfig(@NotNull DataScreenConfigEnum type); |
| | | |
| | | DataScreenConfigVO editDataIndicatorsConfig(DataIndicatorsUpdDTO dto); |
| | | List<DataScreenConfigVO> editDataIndicatorsConfig(List<DataIndicatorsUpdDTO> dtoList); |
| | | |
| | | DataScreenConfigVO editFormalIndicatorsConfig(FormalIndicatorsUpdDTO dto); |
| | | List<DataScreenConfigVO> editFormalIndicatorsConfig(List<FormalIndicatorsUpdDTO> dtoList); |
| | | } |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.enums.AreaLevelEnum; |
| | | import com.ruoyi.common.enums.DataScreenConfigEnum; |
| | | import com.ruoyi.common.enums.SubTypeEnum; |
| | | import com.ruoyi.system.domain.TbDataScreenScore; |
| | | import com.ruoyi.system.vo.DataScreenScoreVO; |
| | | import com.ruoyi.system.vo.RiskMapVO; |
| | | import com.ruoyi.system.vo.RiskRankingVO; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TbDataScreenScoreService extends IService<TbDataScreenScore> { |
| | | |
| | | List<RiskMapVO> queryScore4Map(String nowQuarter, Long dataScreenConfigId); |
| | | |
| | | List<RiskRankingVO> queryRiskRanking(Long dataScreenConfigId, String nowQuarter, |
| | | AreaLevelEnum areaLevelEnum); |
| | | |
| | | List<TbDataScreenScore> selectRiskByQuarter(String nowQuarter, Long dataScreenConfigId, |
| | | String areaCode); |
| | | |
| | | /** |
| | | * @param areaCode |
| | | * @param dataScreenConfigId |
| | | * @param yearType 1:今年 2:去年 |
| | | * @return |
| | | */ |
| | | List<DataScreenScoreVO> queryScoreByAreaAndYear(String areaCode, Long dataScreenConfigId, |
| | | Integer yearType); |
| | | |
| | | /** |
| | | * @param areaCode |
| | | * @param nowQuarter |
| | | * @param dataScreenConfigEnum |
| | | * @param yearType 1:今年 2:去年 |
| | | * @return |
| | | */ |
| | | List<DataScreenScoreVO> selectIndicators(String areaCode, String nowQuarter, |
| | | DataScreenConfigEnum dataScreenConfigEnum, Integer yearType); |
| | | |
| | | Integer getRankByScore(Double score, SubTypeEnum subType, String areaCode, String nowQuarter, |
| | | DataScreenConfigEnum dataScreenConfigEnum); |
| | | } |
| | |
| | | |
| | | PageDTO<FieldVO> queryShowPage(FieldQuery query); |
| | | |
| | | List<FieldVO> listFields(); |
| | | |
| | | List<FieldVO> listFields(String type); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.system.domain.TbScore; |
| | | import com.ruoyi.system.query.CalculateDetailQuery; |
| | | import com.ruoyi.system.query.DeptCalculateDetailQuery; |
| | | import com.ruoyi.system.query.HistoryScoreQuery; |
| | | import com.ruoyi.system.query.ScoreCalculateDetailQuery; |
| | | import com.ruoyi.system.query.ScoreQuery; |
| | | import com.ruoyi.system.vo.DeptCalculateDetailVO; |
| | | import com.ruoyi.system.vo.ScoreCalculateDetailVO; |
| | | import com.ruoyi.system.vo.ScoreRankVO; |
| | | import com.ruoyi.system.vo.ScoreVO; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | PageDTO<ScoreVO> getHistoryScore(HistoryScoreQuery query); |
| | | |
| | | ScoreCalculateDetailVO scoreCalculateDetail(ScoreCalculateDetailQuery query); |
| | | |
| | | List<ScoreRankVO> queryTotalScoreList(); |
| | | |
| | | ScoreRankVO queryRankAndScoreByAreaCode(String areaCode); |
| | | |
| | | List<DeptCalculateDetailVO> deptCalculateDetail(DeptCalculateDetailQuery query, |
| | | String nowQuarter); |
| | | |
| | | ScoreCalculateDetailVO fieldsDetail(CalculateDetailQuery query, List<SysUser> countyList); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectCount(Integer status) { |
| | | return userMapper.selectCount(status); |
| | | public Integer selectCountByStatus(Integer status) { |
| | | return userMapper.selectCountByStatus(status); |
| | | } |
| | | |
| | | // @Override |
| | |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.IntStream; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | List<CalculateItemDTO> calculateItemList = dto.getCalculateItemList(); |
| | | CalculateTypeEnum calculateType = tbBasicDataConfig.getCalculateType(); |
| | | List<CalculateDTO> dtoList = dto.getDtoList(); |
| | | this.save(tbBasicDataConfig); |
| | | if (CalculateTypeEnum.NUMBER.equals(calculateType)) { |
| | | String fieldIdStr = getFieldIdStr(calculateItemList, tbBasicDataConfig); |
| | | tbBasicDataConfig.setFieldIdStr(fieldIdStr); |
| | | this.updateById(tbBasicDataConfig); |
| | | } else { |
| | | if (CollUtils.isEmpty(dtoList)) { |
| | | throw new ServiceException("基础数据配置不能为空"); |
| | |
| | | tbBasicDataConfigDetailService.saveBatch(collect); |
| | | } |
| | | } |
| | | this.save(tbBasicDataConfig); |
| | | } |
| | | |
| | | public boolean hasConsecutiveDuplicates(List<CalculateItemDTO> calculateItemList) { |
| | |
| | | .equals(calculateItemList.get(i).getValueType())); |
| | | } |
| | | |
| | | |
| | | @NotNull |
| | | private String getFieldIdStr(List<CalculateItemDTO> calculateItemList, |
| | | TbBasicDataConfig tbBasicDataConfig) { |
| | | if (CollUtils.isEmpty(calculateItemList)) { |
| | |
| | | tbBasicDataConfig.setFieldIdStr( |
| | | getFieldIdStr(dto.getCalculateItemList(), tbBasicDataConfig)); |
| | | } else { |
| | | if (StringUtils.isEmpty(dto.getFieldIdStr())) { |
| | | throw new ServiceException("字段id不能为空"); |
| | | } |
| | | if (CollUtils.isEmpty(dtoList)) { |
| | | throw new ServiceException("计算公式不能为空"); |
| | | } |
| | |
| | | import com.ruoyi.system.domain.TbBasicDataConfigDetail; |
| | | import com.ruoyi.system.domain.TbBasicDataField; |
| | | import com.ruoyi.system.domain.TbDataScreenScore; |
| | | import com.ruoyi.system.domain.TbDept; |
| | | import com.ruoyi.system.domain.TbField; |
| | | import com.ruoyi.system.domain.TbOperLog; |
| | | import com.ruoyi.system.domain.TbScore; |
| | |
| | | import com.ruoyi.system.listener.BasicDataListener; |
| | | import com.ruoyi.system.listener.HistoryDataListener; |
| | | import com.ruoyi.system.mapper.TbBasicDataMapper; |
| | | import com.ruoyi.system.mapper.TbDeptMapper; |
| | | import com.ruoyi.system.query.CurrentFieldsQuery; |
| | | import com.ruoyi.system.query.ScoreCalculateQuery; |
| | | import com.ruoyi.system.query.ScoreQuery; |
| | |
| | | import com.ruoyi.system.vo.CurrentFieldsDetailVO; |
| | | import com.ruoyi.system.vo.CurrentFieldsVO; |
| | | import com.ruoyi.system.vo.DataScreenConfigVO; |
| | | import com.ruoyi.system.vo.FieldAndScoreDataVO; |
| | | import com.ruoyi.system.vo.FieldsTreeVO; |
| | | import com.ruoyi.system.vo.ScoreCalculateVO; |
| | | import com.ruoyi.system.vo.ScoreVO; |
| | | import com.ruoyi.system.vo.TransferPaymentScaleVO; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.time.Instant; |
| | |
| | | public class TbBasicDataServiceImpl extends ServiceImpl<TbBasicDataMapper, TbBasicData> |
| | | implements TbBasicDataService { |
| | | |
| | | private final TbDeptMapper tbDeptMapper; |
| | | private final HttpServletResponse response; |
| | | private final TbFieldService tbFieldService; |
| | | private final TbBasicDataFieldService tbBasicDataFieldService; |
| | |
| | | private final TbOperLogService tbOperLogService; |
| | | private final TbDataScreenScoreService tbDataScreenScoreService; |
| | | private final TbDataScreenConfigService tbDataScreenConfigService; |
| | | |
| | | |
| | | public static void setFieldValues( |
| | | List<FieldsTreeVO> fields, Map<Long, TbBasicDataField> fieldMap) { |
| | |
| | | String deptAreaCode = user.getAreaCode(); |
| | | BasicDataReportingVO vo = new BasicDataReportingVO(); |
| | | // 校验区划代码 |
| | | TbDept dept = |
| | | tbDeptMapper.selectOne( |
| | | Wrappers.<TbDept>lambdaQuery().eq(TbDept::getAreaCode, deptAreaCode)); |
| | | SysUser dept = |
| | | sysUserService.getOne( |
| | | Wrappers.<SysUser>lambdaQuery().eq(SysUser::getAreaCode, deptAreaCode)); |
| | | if (Objects.isNull(dept)) { |
| | | throw new ServiceException(String.format("区划代码%s不存在", deptAreaCode)); |
| | | } |
| | |
| | | // 判断当前时间是否在季度初1-15号 |
| | | Instant instant = quarterStart.toInstant(); |
| | | LocalDate quarterStartLocalDate = instant.atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | LocalDate fifteenDaysLimit = quarterStartLocalDate.plusDays(15); |
| | | LocalDate fifteenDaysLimit = quarterStartLocalDate.plusDays(14); |
| | | LocalDate now = LocalDate.now(); |
| | | vo.setQuarter(DateUtils.getNowQuarter()); |
| | | vo.setStatus(ReportingStatusEnum.UNFILLED); |
| | | // 如果当前时间不在规定范围内:季度初1-15号 |
| | | if (now.isBefore(quarterStartLocalDate) || now.isAfter(fifteenDaysLimit)) { |
| | | // 如果当前时间不在规定范围内:季度初1-15号 TODO |
| | | /* if (now.isBefore(quarterStartLocalDate) || now.isAfter(fifteenDaysLimit)) { |
| | | return R.ok(vo, "请于季度初1-15号上传季度数据。"); |
| | | } |
| | | }*/ |
| | | // 查询是否有当前季度的填报记录 |
| | | TbBasicData basicData = |
| | | this.getOne( |
| | | Wrappers.<TbBasicData>lambdaQuery() |
| | | .eq(TbBasicData::getDeptAreaCode, dept.getAreaCode()) |
| | | .between(TbBasicData::getCreateTime, quarterStart, quarterEnd)); |
| | | .between(TbBasicData::getReportingTime, quarterStart, quarterEnd)); |
| | | // 查询需要填写的字段 |
| | | List<TbField> list = |
| | | tbFieldService.lambdaQuery().eq(TbField::getStatus, ShowStatusEnum.SHOW).list(); |
| | |
| | | this.updateById(tbBasicData); |
| | | } |
| | | if (ReportingStatusEnum.FILLED.equals(tbBasicData.getStatus())) { |
| | | calculateScore(tbBasicData, tbBasicDataFields); |
| | | CompletableFuture.runAsync(() -> calculateScreenScore(tbBasicData, tbBasicDataFields)); |
| | | CompletableFuture.runAsync(() -> { |
| | | calculateScore(tbBasicData, tbBasicDataFields); |
| | | calculateScreenScore(tbBasicData, tbBasicDataFields); |
| | | }); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private void handleScoreCalculate(TbBasicData tbBasicData, DataScreenConfigVO riskLevel, |
| | | private void handleScoreCalculate(TbBasicData tbBasicData, DataScreenConfigVO vo, |
| | | Map<Long, TbBasicDataField> basicDataFieldMap) { |
| | | List<CalculateItemDTO> scoreCalculateList = riskLevel.getScoreCalculateList(); |
| | | TbDataScreenScore tbDataScreenScore = tbDataScreenScoreService.lambdaQuery() |
| | | .eq(TbDataScreenScore::getBasicDataId, tbBasicData.getId()).eq( |
| | | TbDataScreenScore::getDataScreenConfigId, vo.getId()).one(); |
| | | if (Objects.isNull(tbDataScreenScore)) { |
| | | tbDataScreenScore = new TbDataScreenScore(); |
| | | tbDataScreenScore.setDataScreenConfigId(vo.getId()); |
| | | tbDataScreenScore.setBasicDataId(tbBasicData.getId()); |
| | | tbDataScreenScore.setDeptAreaCode(tbBasicData.getDeptAreaCode()); |
| | | } |
| | | List<CalculateItemDTO> scoreCalculateList = vo.getScoreCalculateList(); |
| | | for (CalculateItemDTO item : scoreCalculateList) { |
| | | if (item.getValueType().equals(ValueTypeEnum.FIELD)) { |
| | | TbBasicDataField basicDataField = basicDataFieldMap.get( |
| | |
| | | String calculateFormulaStr = scoreCalculateList.stream() |
| | | .map(CalculateItemDTO::getContent).collect(Collectors.joining()); |
| | | double score = CalculateUtil.calculate(calculateFormulaStr); |
| | | TbDataScreenScore tbDataScreenScore = new TbDataScreenScore(); |
| | | tbDataScreenScore.setDataScreenConfigId(riskLevel.getId()); |
| | | tbDataScreenScore.setDataScreenConfigId(riskLevel.getId()); |
| | | tbDataScreenScore.setDeptAreaCode(tbBasicData.getDeptAreaCode()); |
| | | tbDataScreenScore.setScore(score); |
| | | tbDataScreenScoreService.save(tbDataScreenScore); |
| | | if (vo.getType().equals(DataScreenConfigEnum.DATA_INDICATORS)) { |
| | | List<CalculateItemDTO> rateCalculateList = vo.getRateCalculateList(); |
| | | for (CalculateItemDTO calculateItemDTO : rateCalculateList) { |
| | | if (calculateItemDTO.getValueType().equals(ValueTypeEnum.FIELD)) { |
| | | TbBasicDataField basicDataField = basicDataFieldMap.get( |
| | | Long.valueOf(calculateItemDTO.getContent())); |
| | | if (Objects.nonNull(basicDataField)) { |
| | | calculateItemDTO.setContent(basicDataField.getFieldValue()); |
| | | } |
| | | } |
| | | } |
| | | String calculateRateFormulaStr = rateCalculateList.stream() |
| | | .map(CalculateItemDTO::getContent).collect(Collectors.joining()); |
| | | double scoreRate = CalculateUtil.calculate(calculateRateFormulaStr); |
| | | tbDataScreenScore.setScoreRate(scoreRate); |
| | | } |
| | | tbDataScreenScoreService.saveOrUpdate(tbDataScreenScore); |
| | | } |
| | | |
| | | private void saveExchangeLog(LoginUser loginUser, TbBasicData tbBasicData, |
| | |
| | | |
| | | @Override |
| | | public void importBasicData(MultipartFile file) throws Exception { |
| | | Map<String, Date> quarterDate = DateUtils.getQuarterDate(new Date()); |
| | | // 当前季度开始 |
| | | Date quarterStart = quarterDate.get("first"); |
| | | // 当前季度结束 |
| | | Date quarterEnd = quarterDate.get("last"); |
| | | // 判断当前时间是否在季度初1-15号 |
| | | Instant instant = quarterStart.toInstant(); |
| | | LocalDate quarterStartLocalDate = instant.atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | LocalDate fifteenDaysLimit = quarterStartLocalDate.plusDays(14); |
| | | LocalDate now = LocalDate.now(); |
| | | //todo |
| | | /* if (now.isBefore(quarterStartLocalDate) || now.isAfter(fifteenDaysLimit)) { |
| | | throw new ServiceException("请于季度初1-15号上传季度数据。"); |
| | | }*/ |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | String areaCode = loginUser.getUser().getAreaCode(); |
| | | EasyExcel.read( |
| | |
| | | tbBasicDataFieldService, |
| | | tbBasicDataConfigService, |
| | | tbBasicDataConfigDetailService, |
| | | tbScoreService)) |
| | | tbScoreService, tbDataScreenScoreService, tbDataScreenConfigService)) |
| | | .sheet() |
| | | .doRead(); |
| | | } |
| | |
| | | if (CalculateTypeEnum.PERCENTAGE.equals( |
| | | textAndPercentage.getCalculateType())) { |
| | | for (Map.Entry<String, String> stringStringEntry : scoreMap.entrySet()) { |
| | | String[] split = stringStringEntry.getKey().split("-"); |
| | | String[] split = stringStringEntry.getKey().split("_"); |
| | | double v = Double.parseDouble( |
| | | textAndPercentageData.getFieldValue()); |
| | | double min = Double.parseDouble(split[0]); |
| | |
| | | .collect(Collectors.toMap(SysUser::getAreaCode, e -> e)); |
| | | Set<Long> basicDataIds = |
| | | basicDataList.stream().map(TbBasicData::getId).collect(Collectors.toSet()); |
| | | Map<Long, TbBasicDataField> basicDataFieldMap = |
| | | tbBasicDataFieldService |
| | | .lambdaQuery() |
| | | .in(TbBasicDataField::getBasicDataId, basicDataIds) |
| | | .list() |
| | | .stream() |
| | | .collect(Collectors.toMap(TbBasicDataField::getFieldId, e -> e)); |
| | | |
| | | List<TbBasicDataField> tbBasicDataFieldList = tbBasicDataFieldService |
| | | .lambdaQuery() |
| | | .in(TbBasicDataField::getBasicDataId, basicDataIds) |
| | | .list(); |
| | | // 值 |
| | | List<Object> result = new ArrayList<>(); |
| | | for (TbBasicData tbBasicData : basicDataList) { |
| | | SysUser user = userMap.get(tbBasicData.getDeptAreaCode()); |
| | | Map<Long, TbBasicDataField> basicDataFieldMap = tbBasicDataFieldList.stream() |
| | | .filter(field -> field.getBasicDataId().equals(tbBasicData.getId())) |
| | | .collect(Collectors.toMap(TbBasicDataField::getFieldId, e -> e)); |
| | | List<String> item = new ArrayList<>(); |
| | | item.add(Objects.nonNull(user) ? user.getAreaName() : ""); |
| | | item.add(tbBasicData.getQuarter()); |
| | |
| | | tbBasicDataFieldService, |
| | | tbBasicDataConfigService, |
| | | tbBasicDataConfigDetailService, |
| | | tbScoreService, sysUserService, quarter)) |
| | | tbScoreService, sysUserService, quarter, tbDataScreenScoreService, |
| | | tbDataScreenConfigService)) |
| | | .sheet() |
| | | .doRead(); |
| | | } |
| | |
| | | headTitles.add(Lists.newArrayList("备注")); |
| | | return headTitles; |
| | | } |
| | | |
| | | @Override |
| | | public Page<TransferPaymentScaleVO> transferPaymentScalePage(Page<TransferPaymentScaleVO> page, |
| | | String quarter) { |
| | | Page<TransferPaymentScaleVO> pageVO = baseMapper.transferPaymentScalePage( |
| | | page, quarter); |
| | | int rank = 1; |
| | | for (TransferPaymentScaleVO record : pageVO.getRecords()) { |
| | | record.setRank(rank++); |
| | | } |
| | | return pageVO; |
| | | } |
| | | |
| | | @Override |
| | | public List<FieldAndScoreDataVO> selectBasicDataFieldsConfig(String areaCode, |
| | | String nowQuarter) { |
| | | return baseMapper.selectBasicDataFieldsConfig(areaCode, nowQuarter); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.system.mapper.TbDataScreenConfigMapper; |
| | | import com.ruoyi.system.service.TbDataScreenConfigService; |
| | | import com.ruoyi.system.vo.DataScreenConfigVO; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public DataScreenConfigVO editRiskLevel(RiskLevelUpdDTO dto) { |
| | | if (dto.areRiskLevelsDistinct()) { |
| | | /* if (dto.areRiskLevelsDistinct()) { |
| | | throw new ServiceException("得分范围不能重叠"); |
| | | } |
| | | }*/ |
| | | //查询是否有该指标配置 |
| | | TbDataScreenConfig tbDataScreenConfig = this.lambdaQuery() |
| | | .eq(TbDataScreenConfig::getType, DataScreenConfigEnum.RISK_LEVEL) |
| | |
| | | } |
| | | } |
| | | |
| | | //表达式校验 |
| | | public boolean hasConsecutiveDuplicates(List<CalculateItemDTO> calculateItemList) { |
| | | return IntStream.range(1, calculateItemList.size()) |
| | | .anyMatch(i -> calculateItemList.get(i - 1).getValueType() |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public DataScreenConfigVO editDataIndicatorsConfig(DataIndicatorsUpdDTO dto) { |
| | | //查询是否有该指标配置 |
| | | TbDataScreenConfig tbDataScreenConfig = this.lambdaQuery() |
| | | .eq(TbDataScreenConfig::getType, DataScreenConfigEnum.DATA_INDICATORS) |
| | | .eq(TbDataScreenConfig::getSubType, |
| | | dto.getSubType()).oneOpt().orElseGet(() -> BeanUtils.copyBean(dto, |
| | | TbDataScreenConfig.class)); |
| | | List<CalculateItemDTO> scoreCalculateList = dto.getScoreCalculateList(); |
| | | List<CalculateItemDTO> rateCalculateList = dto.getRateCalculateList(); |
| | | validateCalculateItemList(scoreCalculateList); |
| | | validateCalculateItemList(rateCalculateList); |
| | | String scoreCalculateFormulaJsonStr = JSON.toJSONString(scoreCalculateList); |
| | | tbDataScreenConfig.setCalculateFormula(scoreCalculateFormulaJsonStr); |
| | | String rateCalculateFormulaJsonStr = JSON.toJSONString(rateCalculateList); |
| | | tbDataScreenConfig.setCalculateRateFormula(rateCalculateFormulaJsonStr); |
| | | tbDataScreenConfig.setType(DataScreenConfigEnum.DATA_INDICATORS); |
| | | this.saveOrUpdate(tbDataScreenConfig); |
| | | DataScreenConfigVO dataScreenConfigVO = BeanUtils.copyBean(tbDataScreenConfig, |
| | | DataScreenConfigVO.class); |
| | | dataScreenConfigVO.setScoreCalculateList(scoreCalculateList); |
| | | dataScreenConfigVO.setRateCalculateList(rateCalculateList); |
| | | return dataScreenConfigVO; |
| | | public List<DataScreenConfigVO> editDataIndicatorsConfig(List<DataIndicatorsUpdDTO> dtoList) { |
| | | List<DataScreenConfigVO> vosList = new ArrayList<>(); |
| | | for (DataIndicatorsUpdDTO dto : dtoList) { |
| | | //查询是否有该指标配置 |
| | | TbDataScreenConfig tbDataScreenConfig = this.lambdaQuery() |
| | | .eq(TbDataScreenConfig::getType, DataScreenConfigEnum.DATA_INDICATORS) |
| | | .eq(TbDataScreenConfig::getSubType, |
| | | dto.getSubType()).oneOpt().orElseGet(() -> BeanUtils.copyBean(dto, |
| | | TbDataScreenConfig.class)); |
| | | List<CalculateItemDTO> scoreCalculateList = dto.getScoreCalculateList(); |
| | | List<CalculateItemDTO> rateCalculateList = dto.getRateCalculateList(); |
| | | validateCalculateItemList(scoreCalculateList); |
| | | validateCalculateItemList(rateCalculateList); |
| | | String scoreCalculateFormulaJsonStr = JSON.toJSONString(scoreCalculateList); |
| | | tbDataScreenConfig.setCalculateFormula(scoreCalculateFormulaJsonStr); |
| | | String rateCalculateFormulaJsonStr = JSON.toJSONString(rateCalculateList); |
| | | tbDataScreenConfig.setCalculateRateFormula(rateCalculateFormulaJsonStr); |
| | | tbDataScreenConfig.setType(DataScreenConfigEnum.DATA_INDICATORS); |
| | | this.saveOrUpdate(tbDataScreenConfig); |
| | | DataScreenConfigVO dataScreenConfigVO = BeanUtils.copyBean(tbDataScreenConfig, |
| | | DataScreenConfigVO.class); |
| | | dataScreenConfigVO.setScoreCalculateList(scoreCalculateList); |
| | | dataScreenConfigVO.setRateCalculateList(rateCalculateList); |
| | | vosList.add(dataScreenConfigVO); |
| | | } |
| | | return vosList; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public DataScreenConfigVO editFormalIndicatorsConfig(FormalIndicatorsUpdDTO dto) { |
| | | //查询是否有该指标配置 |
| | | TbDataScreenConfig tbDataScreenConfig = this.lambdaQuery() |
| | | .eq(TbDataScreenConfig::getType, DataScreenConfigEnum.FORMAL_INDICATORS) |
| | | .eq(TbDataScreenConfig::getSubType, |
| | | dto.getSubType()).oneOpt().orElseGet(() -> BeanUtils.copyBean(dto, |
| | | TbDataScreenConfig.class)); |
| | | tbDataScreenConfig.setType(DataScreenConfigEnum.FORMAL_INDICATORS); |
| | | List<CalculateItemDTO> calculateItemList = dto.getCalculateItemList(); |
| | | validateCalculateItemList(calculateItemList); |
| | | String calculateFormulaJsonStr = JSON.toJSONString(calculateItemList); |
| | | tbDataScreenConfig.setCalculateFormula(calculateFormulaJsonStr); |
| | | this.saveOrUpdate(tbDataScreenConfig); |
| | | DataScreenConfigVO dataScreenConfigVO = BeanUtils.copyBean(tbDataScreenConfig, |
| | | DataScreenConfigVO.class); |
| | | dataScreenConfigVO.setScoreCalculateList(calculateItemList); |
| | | return dataScreenConfigVO; |
| | | public List<DataScreenConfigVO> editFormalIndicatorsConfig( |
| | | List<FormalIndicatorsUpdDTO> dtoList) { |
| | | List<DataScreenConfigVO> vosList = new ArrayList<>(); |
| | | for (FormalIndicatorsUpdDTO dto : dtoList) { |
| | | //查询是否有该指标配置 |
| | | TbDataScreenConfig tbDataScreenConfig = this.lambdaQuery() |
| | | .eq(TbDataScreenConfig::getType, DataScreenConfigEnum.FORMAL_INDICATORS) |
| | | .eq(TbDataScreenConfig::getSubType, |
| | | dto.getSubType()).oneOpt().orElseGet(() -> BeanUtils.copyBean(dto, |
| | | TbDataScreenConfig.class)); |
| | | tbDataScreenConfig.setType(DataScreenConfigEnum.FORMAL_INDICATORS); |
| | | tbDataScreenConfig.setMaxScore(dto.getMaxScore()); |
| | | List<CalculateItemDTO> calculateItemList = dto.getCalculateItemList(); |
| | | validateCalculateItemList(calculateItemList); |
| | | String calculateFormulaJsonStr = JSON.toJSONString(calculateItemList); |
| | | tbDataScreenConfig.setCalculateFormula(calculateFormulaJsonStr); |
| | | this.saveOrUpdate(tbDataScreenConfig); |
| | | DataScreenConfigVO dataScreenConfigVO = BeanUtils.copyBean(tbDataScreenConfig, |
| | | DataScreenConfigVO.class); |
| | | dataScreenConfigVO.setScoreCalculateList(calculateItemList); |
| | | vosList.add(dataScreenConfigVO); |
| | | } |
| | | return vosList; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.AreaLevelEnum; |
| | | import com.ruoyi.common.enums.DataScreenConfigEnum; |
| | | import com.ruoyi.common.enums.SubTypeEnum; |
| | | import com.ruoyi.system.domain.TbDataScreenScore; |
| | | import com.ruoyi.system.mapper.TbDataScreenScoreMapper; |
| | | import com.ruoyi.system.service.TbDataScreenScoreService; |
| | | import com.ruoyi.system.vo.DataScreenScoreVO; |
| | | import com.ruoyi.system.vo.RiskMapVO; |
| | | import com.ruoyi.system.vo.RiskRankingVO; |
| | | import java.util.List; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | ServiceImpl<TbDataScreenScoreMapper, TbDataScreenScore> implements |
| | | TbDataScreenScoreService { |
| | | |
| | | @Override |
| | | public List<RiskMapVO> queryScore4Map(String nowQuarter, Long dataScreenConfigId) { |
| | | return baseMapper.queryScore4Map(nowQuarter, dataScreenConfigId); |
| | | } |
| | | |
| | | @Override |
| | | public List<RiskRankingVO> queryRiskRanking(Long dataScreenConfigId, String nowQuarter, |
| | | AreaLevelEnum areaLevelEnum) { |
| | | return baseMapper.queryRiskRanking(dataScreenConfigId, nowQuarter, areaLevelEnum); |
| | | } |
| | | |
| | | @Override |
| | | public List<TbDataScreenScore> selectRiskByQuarter(String nowQuarter, Long dataScreenConfigId, |
| | | String areaCode) { |
| | | return baseMapper.selectRiskByQuarter(nowQuarter, dataScreenConfigId, areaCode); |
| | | } |
| | | |
| | | @Override |
| | | public List<DataScreenScoreVO> queryScoreByAreaAndYear(String areaCode, |
| | | Long dataScreenConfigId, Integer yearType) { |
| | | return baseMapper.queryScoreByAreaAndYear(areaCode, dataScreenConfigId, yearType); |
| | | } |
| | | |
| | | @Override |
| | | public List<DataScreenScoreVO> selectIndicators(String areaCode, String nowQuarter, |
| | | DataScreenConfigEnum dataScreenConfigEnum, Integer yearType) { |
| | | return baseMapper.selectIndicators(areaCode, nowQuarter, dataScreenConfigEnum, |
| | | yearType); |
| | | } |
| | | |
| | | @Override |
| | | public Integer getRankByScore(Double score, SubTypeEnum subType, String areaCode, |
| | | String nowQuarter, DataScreenConfigEnum dataScreenConfigEnum) { |
| | | return baseMapper.getRankByScore(score, subType, areaCode, nowQuarter, |
| | | dataScreenConfigEnum); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.enums.ReportingStatusEnum; |
| | | import com.ruoyi.common.enums.UserTypeEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.*; |
| | | import com.ruoyi.common.utils.BeanUtils; |
| | | import com.ruoyi.common.utils.CollUtils; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.TbBasicData; |
| | | import com.ruoyi.system.domain.TbDept; |
| | | import com.ruoyi.system.dto.update.DeptFocusDTO; |
| | |
| | | import com.ruoyi.system.service.TbBasicDataService; |
| | | import com.ruoyi.system.service.TbDeptService; |
| | | import com.ruoyi.system.vo.DeptVO; |
| | | import java.io.InputStream; |
| | | import java.time.Instant; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.InputStream; |
| | | import java.time.Instant; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | Page<SysUser> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | Page<SysUser> userPage = sysUserService.lambdaQuery() |
| | | .eq(SysUser::getUserType, UserTypeEnum.DEPARTMENT.getCode()) |
| | | .like(StringUtils.isNotEmpty(query.getAreaName()), SysUser::getAreaName, query.getAreaName()) |
| | | .like(StringUtils.isNotEmpty(query.getUserName()), SysUser::getUserName, query.getUserName()) |
| | | .like(StringUtils.isNotEmpty(query.getPhone()), SysUser::getPhoneNumber, query.getPhone()) |
| | | .like(StringUtils.isNotEmpty(query.getAreaName()), SysUser::getAreaName, |
| | | query.getAreaName()) |
| | | .like(StringUtils.isNotEmpty(query.getUserName()), SysUser::getUserName, |
| | | query.getUserName()) |
| | | .like(StringUtils.isNotEmpty(query.getPhone()), SysUser::getPhoneNumber, |
| | | query.getPhone()) |
| | | .orderByDesc(SysUser::getCreateTime) |
| | | .page(page); |
| | | |
| | |
| | | //使用自定义校验规则 |
| | | importParams.setVerifyHandler(deptVerifyHandler); |
| | | InputStream inputStream = file.getInputStream(); |
| | | ExcelImportResult<DeptExcel> result = ExcelImportUtil.importExcelMore(inputStream, DeptExcel.class, importParams); |
| | | ExcelImportResult<DeptExcel> result = ExcelImportUtil.importExcelMore(inputStream, |
| | | DeptExcel.class, importParams); |
| | | inputStream.close(); |
| | | List<DeptExcel> list = result.getList(); |
| | | |
| | |
| | | } |
| | | List<String> strings = hasDuplicateAreaCode(list); |
| | | if (!CollectionUtils.isEmpty(strings)) { |
| | | throw new ServiceException(String.format("区划代码%s重复,请修改后重新导入", String.join(",", strings))); |
| | | }else { |
| | | throw new ServiceException( |
| | | String.format("区划代码%s重复,请修改后重新导入", String.join(",", strings))); |
| | | } else { |
| | | List<TbDept> tbDeptList = BeanUtils.copyList(list, TbDept.class); |
| | | this.remove(null); |
| | | tbDeptList.forEach(dept->{ |
| | | tbDeptList.forEach(dept -> { |
| | | dept.setPassword(SecurityUtils.encryptPassword(dept.getPassword())); |
| | | }); |
| | | this.saveBatch(tbDeptList); |
| | |
| | | |
| | | /** |
| | | * 校验区划代码是否重复 |
| | | * |
| | | * @param deptList 部门列表 |
| | | * @return 重复的区划代码 |
| | | */ |
| | |
| | | |
| | | @Override |
| | | public void focus(DeptFocusDTO dto) { |
| | | Optional<SysUser> sysUser = sysUserService.lambdaQuery().eq(SysUser::getUserId, dto.getUserId()).oneOpt(); |
| | | Optional<SysUser> sysUser = sysUserService.lambdaQuery() |
| | | .eq(SysUser::getUserId, dto.getUserId()).oneOpt(); |
| | | if (sysUser.isPresent()) { |
| | | sysUserService.lambdaUpdate() |
| | | .eq(SysUser::getUserId, dto.getUserId()) |
| | |
| | | //判断当前时间是否在季度初1-15号 |
| | | Instant instant = quarterStart.toInstant(); |
| | | LocalDate quarterStartLocalDate = instant.atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | LocalDate fifteenDaysLimit = quarterStartLocalDate.plusDays(15); |
| | | LocalDate fifteenDaysLimit = quarterStartLocalDate.plusDays(14); |
| | | LocalDate now = LocalDate.now(); |
| | | //如果当前时间不在规定范围内:季度初1-15号 |
| | | if (now.isAfter(quarterStartLocalDate) || now.isBefore(fifteenDaysLimit)) { |
| | | //查询所有的部门 |
| | | List<SysUser> list = sysUserService.lambdaQuery().eq(SysUser::getUserType, UserTypeEnum.DEPARTMENT.getCode()).list(); |
| | | Set<String> deptAreaCodeList = list.stream().map(SysUser::getAreaCode).collect(Collectors.toSet()); |
| | | List<SysUser> list = sysUserService.lambdaQuery() |
| | | .eq(SysUser::getUserType, UserTypeEnum.DEPARTMENT.getCode()).list(); |
| | | Set<String> deptAreaCodeList = list.stream().map(SysUser::getAreaCode) |
| | | .collect(Collectors.toSet()); |
| | | //查询当前季度填报了数据的部门 |
| | | List<TbBasicData> filledBasicData = tbBasicDataService.lambdaQuery().between(TbBasicData::getCreateTime, quarterStartLocalDate, fifteenDaysLimit) |
| | | List<TbBasicData> filledBasicData = tbBasicDataService.lambdaQuery() |
| | | .between(TbBasicData::getCreateTime, quarterStartLocalDate, fifteenDaysLimit) |
| | | .eq(TbBasicData::getStatus, ReportingStatusEnum.FILLED).list(); |
| | | Set<String> filledDeptCodes = filledBasicData.stream().map(TbBasicData::getDeptAreaCode).collect(Collectors.toSet()); |
| | | Set<String> filledDeptCodes = filledBasicData.stream().map(TbBasicData::getDeptAreaCode) |
| | | .collect(Collectors.toSet()); |
| | | if (!filledDeptCodes.containsAll(deptAreaCodeList)) { |
| | | return R.fail("有部门未上传季度数据"); |
| | | } |
| | |
| | | .eq(TbField::getStatus, ShowStatusEnum.SHOW) |
| | | .eq(StringUtils.isNotNull(query.getFieldType()), TbField::getFieldType, |
| | | query.getFieldType()) |
| | | .eq(TbField::getFieldType, FieldTypeEnum.NUMBER) |
| | | .orderByDesc(TbField::getCreateTime) |
| | | .page(new Page<>(query.getPageNum(), query.getPageSize())); |
| | | if (CollUtils.isEmpty(page.getRecords())) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<FieldVO> listFields() { |
| | | public List<FieldVO> listFields(String type) { |
| | | FieldTypeEnum fieldTypeEnum; |
| | | try { |
| | | fieldTypeEnum = FieldTypeEnum.getEnumByDesc(type); |
| | | } catch (IllegalArgumentException e) { |
| | | throw new ServiceException("非法参数"); |
| | | } |
| | | List<TbField> list = this.list( |
| | | Wrappers.<TbField>lambdaQuery().eq(TbField::getStatus, ShowStatusEnum.SHOW)); |
| | | Wrappers.<TbField>lambdaQuery().eq(TbField::getStatus, ShowStatusEnum.SHOW) |
| | | .eq(Objects.nonNull(fieldTypeEnum), TbField::getFieldType, fieldTypeEnum)); |
| | | return BeanUtils.copyList(list, FieldVO.class); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.BeanUtils; |
| | | import com.ruoyi.common.utils.CollUtils; |
| | | import com.ruoyi.system.domain.TbBasicDataConfig; |
| | | import com.ruoyi.system.domain.TbScore; |
| | | import com.ruoyi.system.mapper.TbScoreMapper; |
| | | import com.ruoyi.system.query.CalculateDetailQuery; |
| | | import com.ruoyi.system.query.DeptCalculateDetailQuery; |
| | | import com.ruoyi.system.query.HistoryScoreQuery; |
| | | import com.ruoyi.system.query.ScoreCalculateDetailQuery; |
| | | import com.ruoyi.system.query.ScoreQuery; |
| | | import com.ruoyi.system.service.TbBasicDataConfigService; |
| | | import com.ruoyi.system.service.TbScoreService; |
| | | import com.ruoyi.system.vo.DeptCalculateDetailVO; |
| | | import com.ruoyi.system.vo.ScoreCalculateDetailVO; |
| | | import com.ruoyi.system.vo.ScoreDetailVO; |
| | | import com.ruoyi.system.vo.ScoreRankVO; |
| | | import com.ruoyi.system.vo.ScoreVO; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class TbScoreServiceImpl extends ServiceImpl<TbScoreMapper, TbScore> implements TbScoreService { |
| | | public class TbScoreServiceImpl extends ServiceImpl<TbScoreMapper, TbScore> implements |
| | | TbScoreService { |
| | | |
| | | private final TbBasicDataConfigService basicDataConfigService; |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public PageDTO<ScoreVO> getHistoryScore(HistoryScoreQuery query) { |
| | | ScoreQuery scoreQuery = BeanUtils.copyBean(query, ScoreQuery.class); |
| | | Page<ScoreVO> scoreVOPage = baseMapper.pageScore(scoreQuery, new Page<>(query.getPageNum(), query.getPageSize())); |
| | | Page<ScoreVO> scoreVOPage = baseMapper.pageScore(scoreQuery, |
| | | new Page<>(query.getPageNum(), query.getPageSize())); |
| | | return PageDTO.of(scoreVOPage); |
| | | } |
| | | |
| | |
| | | Page<ScoreDetailVO> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | |
| | | Page<ScoreDetailVO> pageVO = baseMapper.scoreCalculateDetail(query, page); |
| | | vo.setVo(PageDTO.of(pageVO)); |
| | | vo.setTotal(pageVO.getTotal()); |
| | | vo.setPages(pageVO.getPages()); |
| | | vo.setList(pageVO.getRecords()); |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | public List<ScoreRankVO> queryTotalScoreList() { |
| | | return baseMapper.queryTotalScoreList(); |
| | | } |
| | | |
| | | @Override |
| | | public ScoreRankVO queryRankAndScoreByAreaCode(String areaCode) { |
| | | return baseMapper.queryRankAndScoreByAreaCode(areaCode); |
| | | } |
| | | |
| | | @Override |
| | | public List<DeptCalculateDetailVO> deptCalculateDetail(DeptCalculateDetailQuery query, |
| | | String nowQuarter) { |
| | | return baseMapper.deptCalculateDetail(query, nowQuarter); |
| | | } |
| | | |
| | | @Override |
| | | public ScoreCalculateDetailVO fieldsDetail(CalculateDetailQuery query, |
| | | List<SysUser> countyList) { |
| | | //查询计算类型 |
| | | TbBasicDataConfig config = basicDataConfigService.getById(query.getId()); |
| | | if (Objects.isNull(config)) { |
| | | throw new ServiceException("非法参数"); |
| | | } |
| | | if (CollUtils.isEmpty(countyList)) { |
| | | return new ScoreCalculateDetailVO(); |
| | | } |
| | | List<String> areaCodeList = countyList.stream().map(SysUser::getAreaCode).distinct() |
| | | .collect(Collectors.toList()); |
| | | ScoreCalculateDetailVO vo = new ScoreCalculateDetailVO(); |
| | | vo.setTypeName(config.getTypeName()); |
| | | vo.setCalculateType(config.getCalculateType()); |
| | | Page<ScoreDetailVO> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | Page<ScoreDetailVO> pageVO = baseMapper.fieldsDetail(query, page, areaCodeList); |
| | | vo.setTotal(pageVO.getTotal()); |
| | | vo.setPages(pageVO.getPages()); |
| | | vo.setList(pageVO.getRecords()); |
| | | return vo; |
| | | } |
| | | } |
| | |
| | | @NotBlank(message = "字段id不能为空") |
| | | private String fieldIdStr; |
| | | |
| | | @ApiModelProperty(value = "最大分值") |
| | | private Double maxScore; |
| | | |
| | | @ApiModelProperty(value = "计算公式") |
| | | private List<CalculateItemDTO> CalculateItemList; |
| | | |
| | |
| | | import com.ruoyi.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 |
| | | * @date 2024/3/19 |
| | | */ |
| | | @Data |
| | | @ApiModel(value="字段统计填报视图对象") |
| | | @ApiModel(value = "字段统计填报视图对象") |
| | | public class BasicDataFieldVO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -4911170218076417743L; |
| | |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "填报完成时间",notes = "状态为已填报才展示") |
| | | @ApiModelProperty(value = "填报完成时间", notes = "状态为已填报才展示") |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
| | | private Date updateTime; |
| | | |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/16 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "数据分析评估系统数据视图对象") |
| | | public class DataAnalysisVO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = -6506407847272831542L; |
| | | @ApiModelProperty("地区名称") |
| | | private String areaName; |
| | | |
| | | @ApiModelProperty("区划代码") |
| | | private String areaCode; |
| | | |
| | | @ApiModelProperty("得分") |
| | | private Double score; |
| | | |
| | | @ApiModelProperty("排名") |
| | | private Integer rank; |
| | | |
| | | @ApiModelProperty("风险等级") |
| | | private String riskLevel; |
| | | |
| | | @ApiModelProperty("全年得分") |
| | | private Double yearScore; |
| | | |
| | | @ApiModelProperty("去年得分") |
| | | private Double lastYearScore; |
| | | |
| | | @ApiModelProperty("监管发现问题") |
| | | private List<QuestionVO> questions; |
| | | |
| | | @ApiModelProperty("形式指标得分") |
| | | private List<ScoreDataVO> scoreDataList; |
| | | |
| | | @ApiModelProperty("数据指标得分") |
| | | private List<ScoreRateDataVO> scoreRateDataList; |
| | | |
| | | @ApiModelProperty("字段列表一") |
| | | private List<FieldAndScoreDataVO> scoreRateDataListOne; |
| | | |
| | | @ApiModelProperty("字段列表二") |
| | | private List<FieldAndScoreDataVO> scoreRateDataListTwo; |
| | | |
| | | @ApiModelProperty("字段列表三") |
| | | private List<FieldAndScoreDataVO> scoreRateDataListThree; |
| | | |
| | | @ApiModelProperty("字段列表四") |
| | | private List<FieldAndScoreDataVO> scoreRateDataListFour; |
| | | |
| | | } |
| | | |
| | |
| | | @ApiModelProperty(value = "大屏数据配置id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "最大分值") |
| | | private Double maxScore; |
| | | |
| | | @ApiModelProperty(value = "配置类型(1=风险等级设置 2=数据指标设置 3=形式指标设置)") |
| | | private DataScreenConfigEnum type; |
| | | |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.common.enums.SubTypeEnum; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/17 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value = "大屏得分视图对象") |
| | | public class DataScreenScoreVO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "部门区划代码") |
| | | private String deptAreaCode; |
| | | |
| | | @ApiModelProperty(value = "基础数据id") |
| | | private Long basicDataId; |
| | | |
| | | @ApiModelProperty(value = "配置id ") |
| | | private Long dataScreenConfigId; |
| | | |
| | | @ApiModelProperty(value = "得分") |
| | | private Double score; |
| | | |
| | | @ApiModelProperty("最大分值") |
| | | private Double maxScore; |
| | | |
| | | @ApiModelProperty(value = "得分率") |
| | | private Double scoreRate; |
| | | |
| | | @ApiModelProperty(value = "子类型") |
| | | private SubTypeEnum subType; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.common.enums.CalculateTypeEnum; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/17 |
| | | */ |
| | | @Data |
| | | @ApiModel("部门得分计算视图对象") |
| | | public class DeptCalculateDetailVO { |
| | | |
| | | @ApiModelProperty("类型名称") |
| | | private String typeName; |
| | | @ApiModelProperty("计算方式") |
| | | private CalculateTypeEnum calculateType; |
| | | @ApiModelProperty("得分") |
| | | private Double score; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/17 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "字段得分视图对象") |
| | | public class FieldAndScoreDataVO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 2327604704965853671L; |
| | | |
| | | @ApiModelProperty(value = "计算类型id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("类型名称") |
| | | private String typeName; |
| | | |
| | | @ApiModelProperty("得分") |
| | | private Double score; |
| | | |
| | | @ApiModelProperty("最大分值") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private Double maxScore; |
| | | |
| | | @ApiModelProperty("分类名称") |
| | | private String basicDataCategoryName; |
| | | |
| | | @ApiModelProperty("分类id") |
| | | private String basicDataCategoryId; |
| | | } |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value = "操作人") |
| | | @TableField("create_by") |
| | | private String createBy; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/16 |
| | | */ |
| | | @Data |
| | | @ApiModel("全省统计数视图对象") |
| | | public class ProvinceStaticsVO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 8096999916812384101L; |
| | | |
| | | @ApiModelProperty("省本级") |
| | | private Integer provinceCount; |
| | | @ApiModelProperty("市") |
| | | private Integer cityCount; |
| | | @ApiModelProperty("开发区") |
| | | private Integer developmentZonesCount; |
| | | @ApiModelProperty("县") |
| | | private Integer countyCount; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.util.List; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/16 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "风险等级分布占比/得分分布/转移支付规模") |
| | | public class RiskAndTransferVO { |
| | | |
| | | @ApiModelProperty("转移支付规模") |
| | | private Double transferPaymentScale; |
| | | @ApiModelProperty("风险等级部门数") |
| | | private RiskCountVO riskCountVO; |
| | | @ApiModelProperty("地图回显相关参数") |
| | | private List<RiskMapVO> riskMapVOList; |
| | | @ApiModelProperty("风险等级区间") |
| | | private List<RiskLevelVO> riskLevelVOList; |
| | | } |
| | | |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class RiskCountVO { |
| | | |
| | | @ApiModelProperty("低风险") |
| | | private Integer noRiskCount; |
| | | @ApiModelProperty("一般风险") |
| | | private Integer lowRiskCount; |
| | | @ApiModelProperty("较高风险") |
| | | private Integer mediumRiskCount; |
| | | @ApiModelProperty("高风险") |
| | | private Integer highRiskCount; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.common.enums.RiskLevelEnum; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/16 |
| | | */ |
| | | @Data |
| | | @ApiModel("风险区间视图对象") |
| | | public class RiskLevelVO { |
| | | |
| | | @ApiModelProperty("风险类型") |
| | | private RiskLevelEnum riskLevel; |
| | | @ApiModelProperty("最小值") |
| | | private Double min; |
| | | @ApiModelProperty("最大值") |
| | | private Double max; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("地图回显相关参数") |
| | | public class RiskMapVO { |
| | | |
| | | @ApiModelProperty("区划代码") |
| | | private String areaCode; |
| | | @ApiModelProperty("部门名称") |
| | | private String areaName; |
| | | @ApiModelProperty("风险得分") |
| | | private Double score; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/16 |
| | | */ |
| | | @Data |
| | | @ApiModel("区/县风险排名前十") |
| | | public class RiskRankingVO { |
| | | |
| | | @ApiModelProperty("排名") |
| | | private Integer rank; |
| | | @ApiModelProperty("地区") |
| | | private String areaName; |
| | | @ApiModelProperty("风险得分") |
| | | private Double score; |
| | | @ApiModelProperty("风险等级") |
| | | private String riskLevel; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.enums.CalculateTypeEnum; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.util.List; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | * @date 2024/4/8 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "问题视图对象") |
| | | @ApiModel(value = "得分计算详情视图对象") |
| | | public class ScoreCalculateDetailVO { |
| | | @ApiModelProperty("得分记录") |
| | | PageDTO<ScoreDetailVO> vo; |
| | | |
| | | @ApiModelProperty("类型名称") |
| | | private String typeName; |
| | | @ApiModelProperty("计算方式") |
| | | private CalculateTypeEnum calculateType; |
| | | @ApiModelProperty("总条数") |
| | | protected Long total; |
| | | @ApiModelProperty("总页码数") |
| | | protected Long pages; |
| | | @ApiModelProperty("当前页数据") |
| | | protected List<ScoreDetailVO> list; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.ruoyi.common.enums.SubTypeEnum; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel("形式指标得分数据视图对象") |
| | | public class ScoreDataVO { |
| | | |
| | | @ApiModelProperty("当前得分") |
| | | private Double score; |
| | | @ApiModelProperty("去年得分") |
| | | private Double lastScore; |
| | | @ApiModelProperty(value = "配置类型子类型(1=指标一 2=指标二 3=指标三 4=指标四)") |
| | | private SubTypeEnum subType; |
| | | @ApiModelProperty("最大分值") |
| | | @JsonInclude(JsonInclude.Include.ALWAYS) |
| | | private Double maxScore; |
| | | } |
| | |
| | | |
| | | @Data |
| | | public class ScoreDetailVO { |
| | | |
| | | @ApiModelProperty(value = "填报部门") |
| | | private String areaName; |
| | | |
| | | @ApiModelProperty(value = "部门区划代码") |
| | | private String areaCode; |
| | | |
| | | @ApiModelProperty(value = "负责人姓名") |
| | | private String personInCharge; |
| | | |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/17 |
| | | */ |
| | | @Data |
| | | public class ScoreRankVO { |
| | | |
| | | /** |
| | | * 区划代码 |
| | | */ |
| | | private String areaCode; |
| | | /** |
| | | * 得分 |
| | | */ |
| | | private Double score; |
| | | |
| | | private Integer rank; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.common.enums.SubTypeEnum; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/16 |
| | | */ |
| | | @Data |
| | | @ApiModel("数据指标得分数据视图对象") |
| | | public class ScoreRateDataVO { |
| | | |
| | | @ApiModelProperty("得分") |
| | | private Double score; |
| | | |
| | | @ApiModelProperty("得分率") |
| | | private Double scoreRate; |
| | | |
| | | @ApiModelProperty(value = "配置类型子类型(1=指标一 2=指标二 3=指标三 4=指标四)") |
| | | private SubTypeEnum subType; |
| | | |
| | | @ApiModelProperty("排名") |
| | | private Integer rank; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author mitao |
| | | * @date 2024/4/16 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "转移支付规模视图对象") |
| | | public class TransferPaymentScaleVO { |
| | | |
| | | @ApiModelProperty("排名") |
| | | private Integer rank; |
| | | |
| | | @ApiModelProperty("地区") |
| | | private String areaName; |
| | | |
| | | @ApiModelProperty("转移支付规模") |
| | | private String transferPaymentScale; |
| | | } |
| | |
| | | WHERE u.del_flag = 0 |
| | | AND u.user_type = 1 |
| | | </select> |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | <select id="selectCountByStatus" resultType="java.lang.Integer"> |
| | | select count(*) from sys_user |
| | | <where> |
| | | <if test="status != null"> |
| | |
| | | <result column="calculate_type" property="calculateType"/> |
| | | <result column="number_calculate_formula" property="numberCalculateFormula"/> |
| | | <result column="field_id_str" property="fieldIdStr"/> |
| | | <result column="max_score" property="maxScore"/> |
| | | <result column="status" property="status"/> |
| | | <result column="del_flag" property="delFlag"/> |
| | | <result column="create_by" property="createBy"/> |
| | |
| | | LEFT JOIN tb_basic_data tbd ON ts.basic_data_id = tbd.id |
| | | LEFT JOIN tb_basic_data_config tdc ON ts.basic_data_config_id = tdc.id |
| | | <where> |
| | | tbd.`quarter` = #{query.quarter} |
| | | tbd.`quarter` = #{query.quarter} AND ts.del_flag = 0 AND tbd.del_flag = 0 AND tdc.del_flag = 0 |
| | | <if test="query.typeName !=null and query.typeName != ''"> |
| | | AND tdc.type_name LIKE CONCAT('%',#{query.typeName},'%') |
| | | </if> |
| | |
| | | </if> |
| | | </where> |
| | | GROUP BY tdc.type_name |
| | | |
| | | </select> |
| | | <select id="queryPage" resultType="com.ruoyi.system.vo.BasicDataConfigVO"> |
| | | SELECT tbdc.id,tbdc.type_name,tbdc.calculate_type,tbdc.status,tbdc2.basic_data_category_name AS |
| | |
| | | FROM tb_basic_data_config tbdc |
| | | LEFT JOIN tb_basic_data_category tbdc2 ON tbdc.basic_data_category_id = tbdc2.id |
| | | <where> |
| | | <if test="query.basicDataConfigName != null and query.basicDataConfigName !=''"> |
| | | AND tbdc.type_name LIKE CONCAT('%',#{query.basicDataConfigName},'%') |
| | | tbdc.del_flag = 0 AND tbdc2.del_flag = 0 |
| | | <if test="query.typeName != null and query.typeName !=''"> |
| | | AND tbdc.type_name LIKE CONCAT('%',#{typeName},'%') |
| | | </if> |
| | | <if test="query.status !=null"> |
| | | AND tbdc.status = #{query.status} |
| | |
| | | <if test="query.calculateType !=null"> |
| | | AND tbdc.calculate_type = #{query.calculateType} |
| | | </if> |
| | | ORDER BY tbdc.create_time DESC |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="transferPaymentScalePage" |
| | | resultType="com.ruoyi.system.vo.TransferPaymentScaleVO"> |
| | | SELECT |
| | | tbd.transfer_payment_scale, |
| | | su.area_name |
| | | FROM tb_basic_data tbd |
| | | LEFT JOIN sys_user su |
| | | ON tbd.dept_area_code = su.area_code |
| | | WHERE 1 = 1 AND su.area_name IS NOT NULL |
| | | <if test="quarter != null and quarter !=''"> |
| | | AND tbd.quarter = #{quarter} |
| | | </if> |
| | | ORDER BY tbd.transfer_payment_scale |
| | | DESC |
| | | |
| | | </select> |
| | | <select id="selectBasicDataFieldsConfig" |
| | | resultType="com.ruoyi.system.vo.FieldAndScoreDataVO"> |
| | | SELECT bdc.id, |
| | | ts.score, |
| | | tbdc.basic_data_category_name, |
| | | bdc.type_name, |
| | | bdc.basic_data_category_id, |
| | | bdc.max_score |
| | | FROM tb_basic_data_category tbdc |
| | | LEFT JOIN tb_basic_data_config bdc ON tbdc.id = bdc.basic_data_category_id |
| | | LEFT JOIN tb_score ts ON ts.basic_data_config_id = bdc.id |
| | | LEFT JOIN tb_basic_data tbd ON tbd.id = ts.basic_data_id |
| | | WHERE 1 = 1 |
| | | AND tbd.dept_area_code = #{areaCode} |
| | | AND tbd.quarter = #{nowQuarter} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, dept_area_code, basic_data_id, data_screen_config_id, score, score_rate, create_time |
| | | </sql> |
| | | <select id="queryScore4Map" resultType="com.ruoyi.system.vo.RiskMapVO"> |
| | | SELECT tdss.score, su.area_code, su.area_name |
| | | FROM tb_data_screen_score tdss |
| | | LEFT JOIN tb_data_screen_config tbsc ON tbsc.id = tdss.data_screen_config_id |
| | | LEFT JOIN tb_basic_data tbd ON tbd.id = tdss.basic_data_id |
| | | LEFT JOIN sys_user su ON su.area_code = tbd.dept_area_code |
| | | WHERE 1 = 1 |
| | | AND tbd.quarter = #{nowQuarter} |
| | | AND tbsc.id = #{dataScreenConfigId} |
| | | </select> |
| | | <select id="queryRiskRanking" resultType="com.ruoyi.system.vo.RiskRankingVO"> |
| | | SELECT tdss.score, su.area_code, su.area_name |
| | | FROM tb_data_screen_score tdss |
| | | LEFT JOIN tb_data_screen_config tbsc ON tbsc.id = tdss.data_screen_config_id |
| | | LEFT JOIN tb_basic_data tbd ON tbd.id = tdss.basic_data_id |
| | | LEFT JOIN sys_user su ON su.area_code = tbd.dept_area_code |
| | | WHERE 1 = 1 |
| | | AND tbd.quarter = #{nowQuarter} |
| | | AND tbsc.id = #{dataScreenConfigId} |
| | | AND su.area_level LIKE '县' |
| | | ORDER BY tdss.score DESC |
| | | </select> |
| | | <select id="selectRiskByQuarter" resultType="com.ruoyi.system.domain.TbDataScreenScore"> |
| | | SELECT tdss.* |
| | | FROM tb_data_screen_score tdss |
| | | LEFT JOIN tb_data_screen_config tbsc ON tbsc.id = tdss.data_screen_config_id |
| | | LEFT JOIN tb_basic_data tbd ON tbd.id = tdss.basic_data_id |
| | | WHERE 1 = 1 |
| | | AND tbd.quarter = #{nowQuarter} |
| | | AND tbsc.id = #{dataScreenConfigId} |
| | | <if test="areaCode !=null and areaCode !=''"> |
| | | AND tbd.dept_area_code = #{areaCode} |
| | | </if> |
| | | </select> |
| | | <select id="queryScoreByAreaAndYear" |
| | | resultType="com.ruoyi.system.vo.DataScreenScoreVO"> |
| | | SELECT tdss.*,tbsc.sub_type |
| | | FROM tb_data_screen_score tdss |
| | | LEFT JOIN tb_data_screen_config tbsc ON tbsc.id = tdss.data_screen_config_id |
| | | LEFT JOIN tb_basic_data tbd ON tbd.id = tdss.basic_data_id |
| | | WHERE 1 = 1 |
| | | AND tbd.dept_area_code = #{areaCode} |
| | | AND tbsc.id = #{dataScreenConfigId} |
| | | <if test="yearType==1"> |
| | | AND YEAR(tbd.reporting_time) = YEAR(CURDATE()) |
| | | </if> |
| | | <if test="yearType==2"> |
| | | AND YEAR(tbd.reporting_time) = YEAR(CURDATE())-1 |
| | | </if> |
| | | </select> |
| | | <select id="selectIndicators" |
| | | resultType="com.ruoyi.system.vo.DataScreenScoreVO"> |
| | | SELECT tdss.*,tbsc.sub_type,tbsc.max_score |
| | | FROM tb_data_screen_score tdss |
| | | LEFT JOIN tb_data_screen_config tbsc ON tbsc.id = tdss.data_screen_config_id |
| | | LEFT JOIN tb_basic_data tbd ON tbd.id = tdss.basic_data_id |
| | | WHERE 1 = 1 |
| | | AND tbd.dept_area_code = #{areaCode} |
| | | AND tbsc.type = #{dataScreenConfigEnum} |
| | | <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> |
| | | <if test="nowQuarter!=null and nowQuarter != ''"> |
| | | AND tbd.quarter = #{nowQuarter} |
| | | </if> |
| | | </select> |
| | | <select id="getRankByScore" resultType="java.lang.Integer"> |
| | | SET @rank = 0; |
| | | |
| | | SELECT `rank`, |
| | | score, |
| | | dept_area_code |
| | | FROM (SELECT tdss.score, tdss.dept_area_code, (@rank := @rank + 1) AS `rank` |
| | | FROM tb_data_screen_score tdss |
| | | LEFT JOIN tb_data_screen_config tbsc ON tbsc.id = tdss.data_screen_config_id |
| | | LEFT JOIN tb_basic_data tbd ON tbd.id = tdss.basic_data_id |
| | | WHERE 1 = 1 |
| | | AND tbsc.type = #{dataScreenConfigEnum} |
| | | AND tbsc.sub_type = #{subType} |
| | | AND tbd.quarter = #{nowQuarter} |
| | | ORDER BY tdss.score DESC) AS rank_data |
| | | WHERE dept_area_code = #{areaCode} |
| | | AND score = #{score} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <?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"> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.system.mapper.TbScoreMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.TbScore"> |
| | | <id column="id" property="id"/> |
| | | <result column="basic_data_config_id" property="basicDataConfigId"/> |
| | | <result column="basic_data_id" property="basicDataId"/> |
| | | <result column="score" property="score"/> |
| | | <result column="del_flag" property="delFlag"/> |
| | | <result column="create_by" property="createBy"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_by" property="updateBy"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | </resultMap> |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.TbScore"> |
| | | <id column="id" property="id"/> |
| | | <result column="basic_data_config_id" property="basicDataConfigId"/> |
| | | <result column="basic_data_id" property="basicDataId"/> |
| | | <result column="score" property="score"/> |
| | | <result column="del_flag" property="delFlag"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, basic_data_config_id, basic_data_id, score, del_flag, create_by, create_time, update_by, update_time |
| | | </sql> |
| | | <select id="pageScore" resultType="com.ruoyi.system.vo.ScoreVO"> |
| | | SELECT |
| | | tbdc.type_name, |
| | | tbdc.calculate_type, |
| | | ts.score |
| | | FROM |
| | | tb_score ts |
| | | LEFT JOIN tb_basic_data tbd ON ts.basic_data_id = tbd.id |
| | | LEFT JOIN tb_basic_data_config tbdc ON ts.basic_data_config_id = tbdc.id |
| | | WHERE |
| | | 1=1 |
| | | AND tbd.id = #{query.basicDataId} |
| | | <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!=''"> |
| | | AND tbdc.calculate_type = #{query.type} |
| | | </if> |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, basic_data_config_id, basic_data_id, score, del_flag, create_by, create_time, update_by, update_time |
| | | </sql> |
| | | <select id="pageScore" resultType="com.ruoyi.system.vo.ScoreVO"> |
| | | SELECT |
| | | tbdc.type_name, |
| | | tbdc.calculate_type, |
| | | ts.score |
| | | FROM |
| | | tb_score ts |
| | | LEFT JOIN tb_basic_data tbd ON ts.basic_data_id = tbd.id |
| | | LEFT JOIN tb_basic_data_config tbdc ON ts.basic_data_config_id = tbdc.id |
| | | WHERE |
| | | 1=1 |
| | | AND tbd.id = #{query.basicDataId} |
| | | <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!=''"> |
| | | AND tbdc.calculate_type = #{query.type} |
| | | </if> |
| | | |
| | | </select> |
| | | <select id="scoreCalculateDetail" resultType="com.ruoyi.system.vo.ScoreDetailVO"> |
| | | SELECT |
| | | su.area_name, |
| | | ts.score, |
| | | su.person_in_charge, |
| | | su.phone_number |
| | | FROM tb_score ts |
| | | 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> |
| | | ts.basic_data_config_id = #{query.id} |
| | | <if test="query.areaName != null and query.areaName != ''"> |
| | | AND su.area_name LIKE CONCAT('%',#{query.areaName},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </select> |
| | | <select id="scoreCalculateDetail" resultType="com.ruoyi.system.vo.ScoreDetailVO"> |
| | | SELECT |
| | | su.area_name, |
| | | su.area_code, |
| | | ts.score, |
| | | su.person_in_charge, |
| | | su.phone_number |
| | | FROM tb_score ts |
| | | 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> |
| | | ts.basic_data_config_id = #{query.id} AND su.area_name IS NOT NULL |
| | | <if test="query.areaName != null and query.areaName != ''"> |
| | | AND su.area_name LIKE CONCAT('%',#{query.areaName},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="queryTotalScoreList" resultType="com.ruoyi.system.vo.ScoreRankVO"> |
| | | |
| | | </select> |
| | | <select id="queryRankAndScoreByAreaCode" resultType="com.ruoyi.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` |
| | | 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( |
| | | CURDATE()) |
| | | GROUP BY tbc.dept_area_code |
| | | ORDER BY score |
| | | DESC) AS ranked_data |
| | | WHERE dept_area_code = #{areaCode} |
| | | </select> |
| | | <select id="deptCalculateDetail" resultType="com.ruoyi.system.vo.DeptCalculateDetailVO"> |
| | | SELECT bdc.id, |
| | | ts.score, |
| | | bdc.type_name, |
| | | bdc.calculate_type |
| | | FROM tb_basic_data_category tbdc |
| | | LEFT JOIN tb_basic_data_config bdc ON tbdc.id = bdc.basic_data_category_id |
| | | LEFT JOIN tb_score ts ON ts.basic_data_config_id = bdc.id |
| | | LEFT JOIN tb_basic_data tbd ON tbd.id = ts.basic_data_id |
| | | WHERE 1 = 1 |
| | | AND tbdc.id = #{query.basicDataCategoryId} |
| | | AND tbd.quarter = #{nowQuarter} |
| | | <if test="query.areaCode != null and query.areaCode !=''"> |
| | | AND tbd.dept_area_code = #{query.areaCode} |
| | | </if> |
| | | </select> |
| | | <select id="fieldsDetail" resultType="com.ruoyi.system.vo.ScoreDetailVO"> |
| | | SELECT |
| | | su.area_name, |
| | | su.area_code, |
| | | ts.score, |
| | | su.person_in_charge, |
| | | su.phone_number |
| | | FROM tb_score ts |
| | | 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> |
| | | ts.basic_data_config_id = #{query.id} AND su.area_name IS NOT NULL |
| | | AND su.area_code IN |
| | | <foreach collection="countyList" item="code" open="(" separator="," close=")"> |
| | | #{code} |
| | | </foreach> |
| | | <if test="query.areaCode != null and query.areaCode != ''"> |
| | | AND su.area_code=#{query.areaCode} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |