From 299918864d460132dfcb210007dfb9564be15f04 Mon Sep 17 00:00:00 2001 From: xuefei <564615061@qq.com> Date: 星期五, 11 十二月 2020 09:38:35 +0800 Subject: [PATCH] 补贴页面相关接口 --- platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/service/ISubsidyLogService.java | 33 +++ platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/mapper/SubsidyLogMapper.java | 119 +++++++++++ platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/serviceimpl/ISubsidyLogServiceImpl.java | 23 ++ platform-admin/pom.xml | 1 platform-modules/platform-generator/src/main/java/cn/cetc54/platform/generator/PlatformMPGenerator.java | 14 platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/IndexController.java | 18 + api.md | 239 +++++++++++++++++------ platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/CommonController.java | 48 ++++ platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/vo/SubsidyTypeVo.java | 18 + platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/SubsidyAPIController.java | 50 +++++ platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/FwjgController.java | 1 platform-admin/src/main/resources/application.yml | 1 platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/entity/SubsidyEmum.java | 9 13 files changed, 504 insertions(+), 70 deletions(-) diff --git a/api.md b/api.md index 52079a9..4e2a9f7 100644 --- a/api.md +++ b/api.md @@ -2,15 +2,23 @@ [1.閫氱敤](#1) [ 1.1鑾峰彇鎵�鏈夊尯鍩熸帴鍙(#1.1) + [ 1.2鑾峰彇鍏ㄩ儴琛ヨ创绫诲瀷](#1.2) [2.棣栭〉](#2) - [ 2.1鑾峰彇鍖哄煙娲ヨ创缁熻](#2.1) - -[3.琛ヨ创](#3) - + [ 2.1鑾峰彇鍖哄煙娲ヨ创缁熻](#2.1) + [ 2.2鑾峰彇鍏ㄩ儴琛ヨ创绫诲瀷](#1.2) +[3.琛ヨ创](#3) + [ 3.1鑾峰彇鎬荤粺璁℃暟鎹甝(#3.1) + [ 3.2骞村害鏈堝害缁熻鏁版嵁](#3.2) [4.鏈嶅姟瀵硅薄](#4) -[5.鏈嶅姟鏈烘瀯](#5) +[5.鏈嶅姟鏈烘瀯](#5) + [ 5.1鏍规嵁鍖哄煙id鑾峰彇鍖哄煙涓嬫墍鏈夋満鏋勫拰浜哄憳鏁伴噺浠ュ強璁㈠崟鎬绘暟](#5.1) + [ 5.2鏍规嵁鍖哄煙id鑾峰彇鍖哄煙涓嬫墍鏈夋湇鍔′互鍙婃湇鍔¤鎯呭拰璁㈠崟浜烘暟](#5.2) + [ 5.3鏍规嵁鍖哄煙id鍜岃鍗曢噺鏌ヨ鏈嶅姟鏈烘瀯鎺掑悕鎯呭喌](#5.3) + [ 5.4鏍规嵁鍖哄煙id鍜岃鍗曢噺鏌ヨ鏈嶅姟鏈烘瀯鎺掑悕鎯呭喌](#5.4) + [ 5.5鎵ц涓鍗昡(#5.4) + <h3 id='1'>涓�銆侀�氱敤</h2> <h4 id='1.1'>1.1鑾峰彇鎵�鏈夊尯鍩熸帴鍙�</h4> @@ -18,7 +26,7 @@ > 鑾峰彇鎵�鏈夊尯鍩� ###### URL -> /api/fwjg/getByPage +> /api/common/getAllArea ###### 鏀寔鏍煎紡 > JSON @@ -29,23 +37,119 @@ ###### 璇锋眰鍙傛暟 |鍙傛暟|蹇呴�墊绫诲瀷|璇存槑| |:----- |:-------|:-----|----- | -| pageNumber | 鏄� |int| 鍒嗛〉椤垫暟 | -| pageSize | 鏄� |int| 鍒嗛〉澶у皬 | -| sort | 鍚� |String| 鎺掑簭瀛楁 | -| order | 鍚� |String| 鎺掑簭鏂瑰紡 asc/desc | +###### 杩斿洖瀛楁 +|杩斿洖瀛楁|瀛楁绫诲瀷|璇存槑 | +|:----- |:------|:----------------------------- | +| name | String | 鍚嶇О | +| pid | String | 涓婄骇id | + +###### 杩斿洖绀轰緥 +``` java +{ + "success": true, + "message": "success", + "code": 200, + "timestamp": 1607648233416, + "result": [ + { + "id": "1336922902628536320", + "createBy": null, + "createTime": "2020-12-10 14:37:13", + "updateBy": null, + "updateTime": null, + "delFlag": 0, + "name": "鐭冲搴勫競", + "pid": null + }, + { + "id": "1336923258360041472", + "createBy": null, + "createTime": "2020-12-10 14:38:38", + "updateBy": null, + "updateTime": null, + "delFlag": 0, + "name": "闀垮畨鍖�", + "pid": "1336922902628536320" + }, + ... + ] +} +``` +<h4 id='1.2'>1.2鑾峰彇鍏ㄩ儴琛ヨ创绫诲瀷</h4> +###### 鎺ュ彛鍔熻兘 +> 鑾峰彇鍏ㄩ儴琛ヨ创绫诲瀷 + +###### URL +> /api/common/getAllSubsidyType + +###### 鏀寔鏍煎紡 +> JSON + +###### HTTP璇锋眰鏂瑰紡 +> GET + +###### 璇锋眰鍙傛暟 +|鍙傛暟|蹇呴�墊绫诲瀷|璇存槑| +|:----- |:-------|:-----|----- | +###### 杩斿洖瀛楁 +|杩斿洖瀛楁|瀛楁绫诲瀷|璇存槑 | +|:----- |:------|:----------------------------- | +| index | int | type鍊� | +| name | String | 鍚嶇О | + +###### 杩斿洖绀轰緥 +``` java +{ + "success": true, + "message": "success", + "code": 200, + "timestamp": 1607648519602, + "result": [ + { + "index": 0, + "name": "鍥伴毦娈嬬柧鐢熸椿琛ヨ创" + }, + { + "index": 1, + "name": "閲嶅害娈嬬柧浜虹敓娲昏ˉ璐�" + }, + { + "index": 2, + "name": "楂橀緞鑰佷汉鐢熸椿琛ヨ创" + }, + { + "index": 3, + "name": "楂橀緞鑰佷汉鐢熸椿娲ヨ创" + }, + ... + ] +} +``` +<h3 id='3'>涓夈�佽ˉ璐�</h2> +<h4 id='3.1'>3.1鑾峰彇鎬荤粺璁℃暟鎹�</h4> +###### 鎺ュ彛鍔熻兘 +> 鏍规嵁鍖哄煙id鍜岃ˉ璐寸被鍨嬭幏鍙栨�荤殑缁熻鏁版嵁 + +###### URL +> /api/subsidy/getTotalStatistics + +###### 鏀寔鏍煎紡 +> JSON + +###### HTTP璇锋眰鏂瑰紡 +> GET + +###### 璇锋眰鍙傛暟 +|鍙傛暟|蹇呴�墊绫诲瀷|璇存槑| +|:----- |:-------|:-----|----- | +| areaId | 鍚� |String | 鍖哄煙id | +| type | 鍚� |Integer | 琛ヨ创绫诲瀷 | ###### 杩斿洖瀛楁 |杩斿洖瀛楁|瀛楁绫诲瀷|璇存槑 | |:----- |:------|:----------------------------- | -| total | int | 杩斿洖鍒嗛〉缁撴灉鏁� | -| size | int | 鍒嗛〉澶у皬 | -| current | int | 褰撳墠椤垫暟 | -| pages | int | 鎬诲叡椤垫暟 | -| success | boolean | 鏄惁鎴愬姛 | -| code | int | 杩斿洖code鐮� | -| result | object | 杩斿洖缁撴灉 | -| name | String | 鍚嶇О | -| pid | String | 涓婄骇id | +| totalPersonNum | int | 鑾峰彇琛ヨ创鐨勬�讳汉鏁� | +| fwPersonCount | double | 鎬婚噾棰� | ###### 鎺ュ彛绀轰緥 ``` java @@ -53,53 +157,64 @@ "success": true, "message": "success", "code": 200, - "timestamp": 1607582573231, + "timestamp": 1607648976798, "result": { - "records": [ + "totalPersonNum": 1, + "totalMoney": 100 + } +} +``` +<h4 id='3.2'>3.2骞村害鏈堝害缁熻鏁版嵁</h4> +###### 鎺ュ彛鍔熻兘 +> 鏍规嵁鍖哄煙id鍜岃ˉ璐寸被鍨嬭幏鍙栧勾搴︽湀搴︾粺璁℃暟鎹� + +###### URL +> /api/subsidy/getStatistics + +###### 鏀寔鏍煎紡 +> JSON + +###### HTTP璇锋眰鏂瑰紡 +> GET + +###### 璇锋眰鍙傛暟 +|鍙傛暟|蹇呴�墊绫诲瀷|璇存槑| +|:----- |:-------|:-----|----- | +| areaId | 鍚� |String | 鍖哄煙id | +| type | 鍚� |Integer | 琛ヨ创绫诲瀷 | + +###### 杩斿洖瀛楁 +|杩斿洖瀛楁|瀛楁绫诲瀷|璇存槑 | +|:----- |:------|:----------------------------- | +| monthStatistics | Objec | 鏈堝害缁熻鏁版嵁 | +| yearStatistics | Objec | 骞村害缁熻鏁版嵁 | + +###### 鎺ュ彛绀轰緥 +``` java +{ + "success": true, + "message": "success", + "code": 200, + "timestamp": 1607649436415, + "result": { + "monthStatistics": [ { - "id": "1336922902628536320", - "createBy": null, - "createTime": "2020-12-10 14:37:13", - "updateBy": null, - "updateTime": null, - "delFlag": 0, - "name": "鐭冲搴勫競", - "pid": null - }, - { - "id": "1336923402568601600", - "createBy": null, - "createTime": "2020-12-10 14:39:12", - "updateBy": null, - "updateTime": null, - "delFlag": 0, - "name": "鏂板崕鍖�", - "pid": "1336922902628536320" - }, - { - "id": "1336923441189752832", - "createBy": null, - "createTime": "2020-12-10 14:39:21", - "updateBy": null, - "updateTime": null, - "delFlag": 0, - "name": "姝e畾鍘�", - "pid": "1336922902628536320" + "sum": 100, + "time": "2020-12" } ], - "total": 7, - "size": 10, - "current": 1, - "orders": [], - "hitCount": false, - "searchCount": true, - "pages": 1 + "yearStatistics": [ + { + "sum": 100, + "time": "2020" + } + ] } } ``` -<h3 id='2'>浜屻�佹湇鍔℃満鏋�</h2> -<h4 id='2.1'>2.1鏍规嵁鍖哄煙id鑾峰彇鍖哄煙涓嬫墍鏈夋満鏋勫拰浜哄憳鏁伴噺浠ュ強璁㈠崟鎬绘暟</h4> +<h3 id='5'>浜斻�佹湇鍔℃満鏋�</h2> +<h4 id='5.1'>5.1鏍规嵁鍖哄煙id鑾峰彇鍖哄煙涓嬫墍鏈夋満鏋勫拰浜哄憳鏁伴噺浠ュ強璁㈠崟鎬绘暟</h4> ###### 鎺ュ彛鍔熻兘 > 鏍规嵁鍖哄煙id鑾峰彇鍖哄煙涓嬫墍鏈夋満鏋勫拰浜哄憳鏁伴噺浠ュ強璁㈠崟鎬绘暟 @@ -140,7 +255,7 @@ } } ``` -<h4 id='2.1'>2.1鏍规嵁鍖哄煙id鑾峰彇鍖哄煙涓嬫墍鏈夋湇鍔′互鍙婃湇鍔¤鎯呭拰璁㈠崟浜烘暟</h4> +<h4 id='5.2'>5.2鏍规嵁鍖哄煙id鑾峰彇鍖哄煙涓嬫墍鏈夋湇鍔′互鍙婃湇鍔¤鎯呭拰璁㈠崟浜烘暟</h4> ###### 鎺ュ彛鍔熻兘 > 鏍规嵁鍖哄煙id鑾峰彇鍖哄煙涓嬫墍鏈夋満鏋勫拰浜哄憳鏁伴噺浠ュ強璁㈠崟鎬绘暟 @@ -248,7 +363,7 @@ } } ``` -<h4 id='2.1'>2.3鏍规嵁鍖哄煙id鍜岃鍗曢噺鏌ヨ鏈嶅姟鏈烘瀯鎺掑悕鎯呭喌</h4> +<h4 id='5.3'>5.3鏍规嵁鍖哄煙id鍜岃鍗曢噺鏌ヨ鏈嶅姟鏈烘瀯鎺掑悕鎯呭喌</h4> ###### 鎺ュ彛鍔熻兘 > 鏍规嵁鍖哄煙id鍜岃鍗曢噺鏌ヨ鏈嶅姟鏈烘瀯鎺掑悕鎯呭喌 @@ -275,7 +390,7 @@ ``` -<h4 id='2.1'>2.3鏍规嵁鍖哄煙id鍜岃鍗曢噺鏌ヨ鏈嶅姟鏈烘瀯鎺掑悕鎯呭喌</h4> +<h4 id='5.4'>5.4鏍规嵁鍖哄煙id鍜岃鍗曢噺鏌ヨ鏈嶅姟鏈烘瀯鎺掑悕鎯呭喌</h4> ###### 鎺ュ彛鍔熻兘 > 鏍规嵁鍖哄煙id鍜岃鍗曢噺鏌ヨ瀹為檯鏈嶅姟鎺掑悕鎯呭喌 @@ -301,7 +416,7 @@ ``` java ``` -<h4 id='2.1'>2.4鎵ц涓鍗�</h4> +<h4 id='5.5'>5.5鎵ц涓鍗�</h4> ###### 鎺ュ彛鍔熻兘 > 鎵ц涓鍗� diff --git a/platform-admin/pom.xml b/platform-admin/pom.xml index cb21e9b..2396e2c 100644 --- a/platform-admin/pom.xml +++ b/platform-admin/pom.xml @@ -23,6 +23,7 @@ <artifactId>platform-quartz</artifactId> <version>1.0-SNAPSHOT</version> </dependency> + <dependency> <groupId>cn.cetc54</groupId> <artifactId>platform-zhyl</artifactId> diff --git a/platform-admin/src/main/resources/application.yml b/platform-admin/src/main/resources/application.yml index 066d3f0..e0386fb 100644 --- a/platform-admin/src/main/resources/application.yml +++ b/platform-admin/src/main/resources/application.yml @@ -152,6 +152,7 @@ ignored: # 鏃犻渶鐧诲綍璁よ瘉鐨勮姹� urls: + - /api/** - /platform/file/** - /platform/oauth2/** - /platform/actuator/** diff --git a/platform-modules/platform-generator/src/main/java/cn/cetc54/platform/generator/PlatformMPGenerator.java b/platform-modules/platform-generator/src/main/java/cn/cetc54/platform/generator/PlatformMPGenerator.java index 321cfeb..f79de8d 100644 --- a/platform-modules/platform-generator/src/main/java/cn/cetc54/platform/generator/PlatformMPGenerator.java +++ b/platform-modules/platform-generator/src/main/java/cn/cetc54/platform/generator/PlatformMPGenerator.java @@ -31,7 +31,7 @@ * 瀹炰綋绫诲悕 * 寤鸿浠呴渶淇敼 */ - private static final String className = "Student"; + private static final String className = "Test"; /** * 绫昏鏄庢弿杩� @@ -60,37 +60,37 @@ * 鐢熸垚妯″潡璺緞 * (鏂囦欢鑷姩鐢熸垚鑷宠妯″潡涓�) */ - private static final String module = "/platform-modules/platform-your"; + private static final String module = "/platform-modules/platform-zhyl"; /** * 瀹炰綋绫诲搴斿寘 * (鏂囦欢鑷姩鐢熸垚鑷宠鍖呬笅) */ - private static final String entityPackage = "cn.cetc54.platform.your.entity"; + private static final String entityPackage = "cn.cetc54.platform.zhyl.entity"; /** * dao瀵瑰簲鍖� 銆愭敞鎰忎慨鏀瑰悗闇�鍒癱n.cetc54.platform.core.config.mybatisplus.MybatisPlusConfig閰嶇疆浣犵殑mapper璺緞鎵弿銆� * (鏂囦欢鑷姩鐢熸垚鑷宠鍖呬笅) */ - private static final String daoPackage = "cn.cetc54.platform.your.mapper"; + private static final String daoPackage = "cn.cetc54.platform.zhyl.mapper"; /** * service瀵瑰簲鍖� * (鏂囦欢鑷姩鐢熸垚鑷宠鍖呬笅) */ - private static final String servicePackage = "cn.cetc54.platform.your.service"; + private static final String servicePackage = "cn.cetc54.platform.zhyl.service"; /** * serviceImpl瀵瑰簲鍖� * (鏂囦欢鑷姩鐢熸垚鑷宠鍖呬笅) */ - private static final String serviceImplPackage = "cn.cetc54.platform.your.serviceimpl"; + private static final String serviceImplPackage = "cn.cetc54.platform.zhyl.serviceimpl"; /** * controller瀵瑰簲鍖� * (鏂囦欢鑷姩鐢熸垚鑷宠鍖呬笅) */ - private static final String controllerPackage = "cn.cetc54.platform.your.controller"; + private static final String controllerPackage = "cn.cetc54.platform.zhyl.controller"; /** * 杩愯璇ヤ富鍑芥暟鍗冲彲鐢熸垚浠g爜 diff --git a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/CommonController.java b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/CommonController.java new file mode 100644 index 0000000..5f734df --- /dev/null +++ b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/CommonController.java @@ -0,0 +1,48 @@ +package cn.cetc54.platform.zhyl.api; + +import cn.cetc54.platform.core.common.utils.ResultUtil; +import cn.cetc54.platform.core.common.vo.Result; +import cn.cetc54.platform.zhyl.entity.Area; +import cn.cetc54.platform.zhyl.entity.SubsidyEmum; +import cn.cetc54.platform.zhyl.service.IAreaService; +import cn.cetc54.platform.zhyl.vo.SubsidyTypeVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author xfei + * @date 2020/12/10 + */ +@Slf4j +@RestController +@Api(description = "閫氱敤鎺ュ彛") +@RequestMapping("/api/common") +public class CommonController { + @Autowired + private IAreaService iAreaService; + @GetMapping("/getAllArea") + @ApiOperation(value = "鑾峰彇鍏ㄩ儴鍖哄煙") + public Result<List<Area>> getAll(){ + List<Area> list = iAreaService.list(); + return new ResultUtil<List<Area>>().setData(list); + } + @GetMapping("/getAllSubsidyType") + @ApiOperation(value = "鑾峰彇鍏ㄩ儴琛ヨ创绫诲瀷") + public Result<List<SubsidyTypeVo>> getAllSubsidyType(){ + List<SubsidyTypeVo> list = new ArrayList<>(); + for (SubsidyEmum emum:SubsidyEmum.values()){ + list.add(new SubsidyTypeVo(emum.ordinal(),emum.name())); + } + return new ResultUtil<List<SubsidyTypeVo>>().setData(list); + + } +} diff --git a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/FwjgController.java b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/FwjgController.java index bd854c8..3bc9dc7 100644 --- a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/FwjgController.java +++ b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/FwjgController.java @@ -13,7 +13,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import javafx.collections.ObservableList; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; diff --git a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/IndexController.java b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/IndexController.java new file mode 100644 index 0000000..1f2d4e8 --- /dev/null +++ b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/IndexController.java @@ -0,0 +1,18 @@ +package cn.cetc54.platform.zhyl.api; + +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author xfei + * @date 2020/12/10 + */ +@Slf4j +@RestController +@Api(description = "棣栭〉鎺ュ彛") +@RequestMapping("/api/index") +public class IndexController { + +} diff --git a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/SubsidyAPIController.java b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/SubsidyAPIController.java new file mode 100644 index 0000000..6c8a2fe --- /dev/null +++ b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/api/SubsidyAPIController.java @@ -0,0 +1,50 @@ +package cn.cetc54.platform.zhyl.api; + +import cn.cetc54.platform.core.common.utils.ResultUtil; +import cn.cetc54.platform.core.common.vo.Result; +import cn.cetc54.platform.zhyl.service.ISubsidyLogService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author xfei + * @date 2020/12/10 + */ +@Slf4j +@RestController +@Api(description = "琛ヨ创椤甸潰鎺ュ彛") +@RequestMapping("/api/subsidy") +public class SubsidyAPIController { + @Autowired + private ISubsidyLogService iSubsidyLogService; + @GetMapping("/getTotalStatistics") + @ApiOperation(value = "鑾峰彇鎬荤粺璁℃暟鎹�") + public Result getTotalStatistics(String areaId,Integer type){ + int totalPersonNum = iSubsidyLogService.getTotalNum(areaId,type);//鑾峰彇琛ヨ创鐨勬�讳汉鏁� + double totalMoney = iSubsidyLogService.getTotalMoney(areaId,type);//鑾峰彇鎬婚噾棰� + + Map<String,Object> resMap = new HashMap<>(); + resMap.put("totalPersonNum",totalPersonNum); + resMap.put("totalMoney",totalMoney); + return ResultUtil.data(resMap); + + } + @GetMapping("/getStatistics") + @ApiOperation(value = "骞村害鏈堝害缁熻鏁版嵁") + public Result getStatistics(String areaId,Integer type){ + Map<String,Object> resMap = new HashMap<>(); + resMap.put("monthStatistics",iSubsidyLogService.getMonthTotal(areaId,type)); + resMap.put("yearStatistics",iSubsidyLogService.getYearTotal(areaId,type)); + return ResultUtil.data(resMap); + + } + +} diff --git a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/entity/SubsidyEmum.java b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/entity/SubsidyEmum.java new file mode 100644 index 0000000..edb6300 --- /dev/null +++ b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/entity/SubsidyEmum.java @@ -0,0 +1,9 @@ +package cn.cetc54.platform.zhyl.entity; + +/** + * @author xfei + * @date 2020/12/10 + */ +public enum SubsidyEmum { + 鍥伴毦娈嬬柧鐢熸椿琛ヨ创,閲嶅害娈嬬柧浜虹敓娲昏ˉ璐�,楂橀緞鑰佷汉鐢熸椿琛ヨ创,楂橀緞鑰佷汉鐢熸椿娲ヨ创,鐧惧瞾瀵挎槦钀ュ吇琛ヨ创,闆嗕腑渚涘簲鍎跨,鏁e眳鍎跨,鏃犱汉鎶氬吇鍎跨,鍩庡競鐗瑰洶浜哄憳,鍐滄潙鐗瑰洶浜哄憳,鍩庡競浣庝繚瀹跺涵,鍐滄潙浣庝繚瀹跺涵 +} diff --git a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/mapper/SubsidyLogMapper.java b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/mapper/SubsidyLogMapper.java index 9baa968..300dda8 100644 --- a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/mapper/SubsidyLogMapper.java +++ b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/mapper/SubsidyLogMapper.java @@ -2,13 +2,132 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.cetc54.platform.zhyl.entity.SubsidyLog; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; import java.util.List; +import java.util.Map; + /** * 琛ヨ创鏃ュ織鏁版嵁澶勭悊灞� * @author */ public interface SubsidyLogMapper extends BaseMapper<SubsidyLog> { + //鑾峰彇琛ヨ创鎬讳汉鏁� + @Select("<script>" + + " select SUM(duixiang_id) from t_yl_subsidy_log" + + " <where> " + + " <if test='areaId!= null'>" + + " and area_id = #{areaId}" + + " </if>" + + " <if test='type!= null'>" + + " and type = #{type}" + + " </if>" + + " </where>" + + " GROUP BY duixiang_id"+ + " </script>") + Integer getTotalNum(@Param(value = "areaId")String areaId, @Param(value = "type")Integer type); + + /** + * 鑾峰彇鎬婚噾棰� + * @param areaId + * @param type + * @return + */ + @Select("<script>" + + " select SUM(money) from t_yl_subsidy_log" + + " <where> " + + " <if test='areaId!= null'>" + + " and area_id = #{areaId}" + + " </if>" + + " <if test='type!= null'>" + + " and type = #{type}" + + " </if>" + + " </where>" + + " GROUP BY duixiang_id"+ + " </script>") + Double getTotalMoney(@Param(value = "areaId")String areaId, @Param(value = "type")Integer type); + + /** + * 鑾峰彇鏈堝害缁熻 + * @param areaId + * @param type + * @return + * SELECT + * CONCAT(YEAR(create_time),'-',MONTH(create_time)) AS releaseYearMonth, + * SUM(money) as sum + * FROM t_yl_subsidy_log + * GROUP BY releaseYearMonth ORDER BY releaseYearMonth desc LIMIT 12 + */ + @Select("<script>" + + " select CONCAT(YEAR(create_time),'-',MONTH(create_time)) AS time," + + "SUM(money) as sum FROM t_yl_subsidy_log" + + " <where> " + + " <if test='areaId!= null'>" + + " and area_id = #{areaId}" + + " </if>" + + " <if test='type!= null'>" + + " and type = #{type}" + + " </if>" + + " </where>" + + " GROUP BY time ORDER BY time desc LIMIT 12"+ + " </script>") + List<Map<String,Object>> getMonthTotal(@Param(value = "areaId")String areaId, @Param(value = "type")Integer type); + + /** + * 鑾峰彇骞村害缁熻 + * @param areaId + * @param type + * @return + */ + @Select("<script>" + + " select CONCAT(YEAR(create_time)) AS time," + + "SUM(money) as sum FROM t_yl_subsidy_log" + + " <where> " + + " <if test='areaId!= null'>" + + " and area_id = #{areaId}" + + " </if>" + + " <if test='type!= null'>" + + " and type = #{type}" + + " </if>" + + " </where>" + + " GROUP BY time ORDER BY time desc LIMIT 12"+ + " </script>") + List<Map<String,Object>> getYearTotal(@Param(value = "areaId")String areaId, @Param(value = "type")Integer type); + + /** + *缁熻姣忕琛ヨ创鐨勯噾棰濇暟 + * @param areaId + * @return + */ + @Select("<script>" + + " select type," + + "SUM(money) as sum FROM t_yl_subsidy_log" + + " <where> " + + " <if test='areaId!= null'>" + + " and area_id = #{areaId}" + + " </if>" + + " </where>" + + " GROUP BY type ORDER BY money desc"+ + " </script>") + List<Map<String,Object>> getTypeMoney(@Param(value = "areaId")String areaId); + + /** + * 姣忕琛ヨ创鐨勬鏁� + * @param areaId + * @return + */ + @Select("<script>" + + " select type," + + "conunt(id) as num FROM t_yl_subsidy_log" + + " <where> " + + " <if test='areaId!= null'>" + + " and area_id = #{areaId}" + + " </if>" + + " </where>" + + " GROUP BY type ORDER BY num desc"+ + " </script>") + List<Map<String,Object>> getTypeNum(@Param(value = "areaId")String areaId); } \ No newline at end of file diff --git a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/service/ISubsidyLogService.java b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/service/ISubsidyLogService.java index c1ea7ed..611932e 100644 --- a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/service/ISubsidyLogService.java +++ b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/service/ISubsidyLogService.java @@ -2,8 +2,10 @@ import com.baomidou.mybatisplus.extension.service.IService; import cn.cetc54.platform.zhyl.entity.SubsidyLog; +import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; /** * 琛ヨ创鏃ュ織鎺ュ彛 @@ -11,4 +13,35 @@ */ public interface ISubsidyLogService extends IService<SubsidyLog> { + /** + * 鑾峰彇琛ヨ创鐨勬�讳汉鏁� + * @param areaId + * @return + */ + int getTotalNum(String areaId,Integer type); + + /** + * 鑾峰彇鎬婚噾棰� + * @param areaId + * @param type + * @return + */ + double getTotalMoney(String areaId,Integer type); + + /** + * 鑾峰彇鏈堝害缁熻 + * @param areaId + * @param type + * @return + */ + List<Map<String,Object>> getMonthTotal(String areaId,Integer type); + + /** + * 鑾峰彇骞村害缁熻 + * @param areaId + * @param type + * @return + */ + List<Map<String,Object>> getYearTotal(String areaId,Integer type); + } \ No newline at end of file diff --git a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/serviceimpl/ISubsidyLogServiceImpl.java b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/serviceimpl/ISubsidyLogServiceImpl.java index cb30929..a601198 100644 --- a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/serviceimpl/ISubsidyLogServiceImpl.java +++ b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/serviceimpl/ISubsidyLogServiceImpl.java @@ -11,6 +11,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Map; /** * 琛ヨ创鏃ュ織鎺ュ彛瀹炵幇 @@ -23,4 +24,26 @@ @Autowired private SubsidyLogMapper subsidyLogMapper; + + @Override + public int getTotalNum(String areaId,Integer type) { + Integer num = subsidyLogMapper.getTotalNum(areaId,type); + return num==null?0:num; + } + + @Override + public double getTotalMoney(String areaId, Integer type) { + Double money = subsidyLogMapper.getTotalMoney(areaId,type); + return money==null?0:money; + } + + @Override + public List<Map<String, Object>> getMonthTotal(String areaId, Integer type) { + return subsidyLogMapper.getMonthTotal(areaId,type); + } + + @Override + public List<Map<String, Object>> getYearTotal(String areaId, Integer type) { + return subsidyLogMapper.getYearTotal(areaId,type); + } } \ No newline at end of file diff --git a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/vo/SubsidyTypeVo.java b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/vo/SubsidyTypeVo.java new file mode 100644 index 0000000..5941955 --- /dev/null +++ b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/vo/SubsidyTypeVo.java @@ -0,0 +1,18 @@ +package cn.cetc54.platform.zhyl.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 琛ヨ创绫诲瀷 + * @author xfei + * @date 2020/12/10 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class SubsidyTypeVo { + private int index; + private String name; +} -- Gitblit v1.9.1