Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
civil-bigdata
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
civil
civil-bigdata
Commits
670439a5
Commit
670439a5
authored
Jun 25, 2021
by
袁伟铭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
c0931429
Hide whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
1015 additions
and
467 deletions
+1015
-467
api-server/src/main/java/com/zq/api/ApiApplication.java
+0
-2
api-server/src/main/java/com/zq/api/controller/ApiController.java
+1
-1
api-server/src/main/java/com/zq/api/feign/CmsFeign.java
+0
-18
api-server/src/main/java/com/zq/api/feign/PortalFeign.java
+23
-0
api-server/src/main/java/com/zq/api/feign/UserFeign.java
+25
-0
api-server/src/main/java/com/zq/api/form/ApiForm.java
+2
-3
api-server/src/main/java/com/zq/api/service/IApiLogic.java
+51
-2
api-server/src/main/java/com/zq/api/service/impl/ApiV100Logic.java
+38
-12
common-utils/src/main/java/com/zq/common/config/base/UnifiedExceptionHandler.java
+12
-6
common-utils/src/main/java/com/zq/common/constant/DBName.java
+1
-1
common-utils/src/main/java/com/zq/common/entity/AppUser.java
+4
-4
common-utils/src/main/java/com/zq/common/entity/VDemographics.java
+16
-36
common-utils/src/main/java/com/zq/common/entity/VMarriageStats.java
+24
-0
portal-server/src/main/java/com/zq/portal/config/TokenFilter.java
+1
-1
portal-server/src/main/java/com/zq/portal/controller/admin/DemographicsAdminController.java
+28
-0
portal-server/src/main/java/com/zq/portal/controller/admin/HyAdminStatsController.java
+0
-55
portal-server/src/main/java/com/zq/portal/controller/admin/HyStatsAdminController.java
+49
-0
portal-server/src/main/java/com/zq/portal/controller/admin/StatsAdminController.java
+0
-5
portal-server/src/main/java/com/zq/portal/controller/app/AreaController.java
+26
-0
portal-server/src/main/java/com/zq/portal/controller/app/BzStatsController.java
+20
-0
portal-server/src/main/java/com/zq/portal/controller/app/CjStatsController.java
+3
-3
portal-server/src/main/java/com/zq/portal/controller/app/HyStatsController.java
+18
-16
portal-server/src/main/java/com/zq/portal/controller/app/ShzzStatsController.java
+2
-2
portal-server/src/main/java/com/zq/portal/controller/app/StatsController.java
+0
-36
portal-server/src/main/java/com/zq/portal/dao/BzStatsDao.java
+1
-1
portal-server/src/main/java/com/zq/portal/dao/CjStatsDao.java
+1
-1
portal-server/src/main/java/com/zq/portal/dao/DbStatsDao.java
+1
-4
portal-server/src/main/java/com/zq/portal/dao/HyStatsDao.java
+20
-5
portal-server/src/main/java/com/zq/portal/dao/ShzzStatsDao.java
+1
-1
portal-server/src/main/java/com/zq/portal/dao/VDemographicsDao.java
+4
-4
portal-server/src/main/java/com/zq/portal/manager/CacheKeys.java
+7
-0
portal-server/src/main/java/com/zq/portal/service/AreaService.java
+18
-0
portal-server/src/main/java/com/zq/portal/service/BzStatsService.java
+9
-0
portal-server/src/main/java/com/zq/portal/service/CjStatsService.java
+27
-0
portal-server/src/main/java/com/zq/portal/service/DemographicsService.java
+38
-0
portal-server/src/main/java/com/zq/portal/service/HyStatsService.java
+224
-0
portal-server/src/main/java/com/zq/portal/service/ShzzStatsService.java
+11
-0
portal-server/src/main/java/com/zq/portal/service/StatsService.java
+0
-161
portal-server/src/main/java/com/zq/portal/task/HyTask.java
+46
-0
portal-server/src/main/java/com/zq/portal/vo/LineDataVo.java
+20
-0
portal-server/src/main/resources/application.yml
+5
-0
portal-server/src/main/resources/mapper/HyStatsMapper.xml
+80
-41
user-server/pom.xml
+5
-0
user-server/src/main/java/com/zq/user/Swagger.java
+64
-0
user-server/src/main/java/com/zq/user/controller/app/UserController.java
+8
-0
user-server/src/main/java/com/zq/user/dao/PfuserDao.java
+3
-0
user-server/src/main/java/com/zq/user/service/UserService.java
+37
-5
user-server/src/main/resources/application.yml
+41
-41
No files found.
api-server/src/main/java/com/zq/api/ApiApplication.java
View file @
670439a5
package
com
.
zq
.
api
;
import
com.zq.common.config.base.SpringContextHolder
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
...
...
api-server/src/main/java/com/zq/api/controller/ApiController.java
View file @
670439a5
...
...
@@ -31,7 +31,7 @@ public class ApiController {
private
final
ApiService
apiService
;
// 允许用户未登录状态下执行的方法名
private
String
[]
allowMethod
=
{
"test
"
};
private
final
String
[]
allowMethod
=
{
"sendCode"
,
"resetPassword"
,
"phoneLogin"
,
"passwdLogin
"
};
/**
* 获取信息入口
...
...
api-server/src/main/java/com/zq/api/feign/CmsFeign.java
deleted
100644 → 0
View file @
c0931429
package
com
.
zq
.
api
.
feign
;
import
com.zq.api.config.FeignConfig
;
import
com.zq.common.vo.ResultVo
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
java.util.Map
;
@FeignClient
(
name
=
"CMS-SERVER"
,
configuration
=
FeignConfig
.
class
)
//指定调用哪个微服务
@RequestMapping
(
"/cms"
)
public
interface
CmsFeign
{
@GetMapping
(
"/adviceFeedback/getAdviceFeedbackById"
)
ResultVo
test
(
Map
<
String
,
Object
>
paramsMap
);
}
api-server/src/main/java/com/zq/api/feign/PortalFeign.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
api
.
feign
;
import
com.zq.api.config.FeignConfig
;
import
com.zq.common.vo.ResultVo
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Map
;
@FeignClient
(
name
=
"PORTAL-SERVER"
,
configuration
=
FeignConfig
.
class
)
//指定调用哪个微服务
@RequestMapping
(
"/portal/app"
)
public
interface
PortalFeign
{
@PostMapping
(
"/stats/getMarriageStats"
)
ResultVo
getMarriageStats
(
@RequestBody
Map
<
String
,
Object
>
paramsMap
);
@PostMapping
(
"/stats/getAreaUnderMarriageStatsList"
)
ResultVo
getAreaUnderMarriageStatsList
(
@RequestBody
Map
<
String
,
Object
>
paramsMap
);
@GetMapping
(
"/area/getChildAreaList"
)
ResultVo
getChildAreaList
(
@RequestParam
String
areaCode
);
}
api-server/src/main/java/com/zq/api/feign/UserFeign.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
api
.
feign
;
import
com.zq.api.config.FeignConfig
;
import
com.zq.common.vo.ResultVo
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Map
;
@FeignClient
(
name
=
"USER-SERVER"
,
configuration
=
FeignConfig
.
class
)
//指定调用哪个微服务
@RequestMapping
(
"/user/app"
)
public
interface
UserFeign
{
@GetMapping
(
"/user/sendCode"
)
ResultVo
sendCode
(
@RequestParam
String
phone
);
@PostMapping
(
"/user/resetPassword"
)
ResultVo
resetPassword
(
@RequestBody
Map
<
String
,
Object
>
paramsMap
);
@PostMapping
(
"/user/phoneLogin"
)
ResultVo
phoneLogin
(
@RequestBody
Map
<
String
,
Object
>
paramsMap
);
@PostMapping
(
"/user/passwdLogin"
)
ResultVo
passwdLogin
(
@RequestBody
Map
<
String
,
Object
>
paramsMap
);
}
api-server/src/main/java/com/zq/api/form/ApiForm.java
View file @
670439a5
...
...
@@ -7,8 +7,6 @@ import com.alibaba.fastjson.JSONObject;
import
com.zq.api.config.ConfigCache
;
import
com.zq.api.utils.ApiUtils
;
import
com.zq.api.utils.NumberUtils
;
import
com.zq.common.encrypt.EncryptUtils
;
import
com.zq.common.encrypt.RsaUtils
;
import
com.zq.common.vo.ApiTokenVo
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -117,7 +115,8 @@ public class ApiForm {
* @return
*/
public
String
get
(
String
key
)
{
return
getContentJson
().
getString
(
key
);
String
value
=
getContentJson
().
getString
(
key
);
return
value
==
null
?
""
:
value
;
}
/**
...
...
api-server/src/main/java/com/zq/api/service/IApiLogic.java
View file @
670439a5
...
...
@@ -11,11 +11,60 @@ import com.zq.api.form.ApiResp;
public
interface
IApiLogic
extends
IApiCommon
{
/**
*
测试连接
*
发送验证码
*
* @param form
* @return
*/
ApiResp
test
(
ApiForm
form
);
ApiResp
sendCode
(
ApiForm
form
);
/**
* 重置密码
*
* @param form
* @return
*/
ApiResp
resetPassword
(
ApiForm
form
);
/**
* 用户手机号登录
*
* @param form
* @return
*/
ApiResp
phoneLogin
(
ApiForm
form
);
/**
* 密码登录
*
* @param form
* @return
*/
ApiResp
passwdLogin
(
ApiForm
form
);
/************************************************************************/
/**
* 获取婚姻统计
*
* @param form
* @return
*/
ApiResp
getMarriageStats
(
ApiForm
form
);
/**
* 获取区域下的婚姻统计列表
*
* @param form
* @return
*/
ApiResp
getAreaUnderMarriageStatsList
(
ApiForm
form
);
/**
* 获取子区域列表
*
* @param form
* @return
*/
ApiResp
getChildAreaList
(
ApiForm
form
);
}
api-server/src/main/java/com/zq/api/service/impl/ApiV100Logic.java
View file @
670439a5
package
com
.
zq
.
api
.
service
.
impl
;
import
com.zq.api.feign.CmsFeign
;
import
com.zq.api.feign.PortalFeign
;
import
com.zq.api.feign.UserFeign
;
import
com.zq.api.form.ApiForm
;
import
com.zq.api.form.ApiResp
;
import
com.zq.api.service.IApiLogic
;
import
com.zq.api.utils.ApiUtils
;
import
com.zq.common.vo.ResultVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
...
...
@@ -13,16 +13,42 @@ import org.springframework.stereotype.Component;
public
class
ApiV100Logic
extends
BaseApiLogic
implements
IApiLogic
{
@Autowired
private
CmsFeign
cmsFeign
;
/**
* 测试连接
*
* @param form
* @return
*/
private
UserFeign
userFeign
;
@Autowired
private
PortalFeign
portalFeign
;
@Override
public
ApiResp
sendCode
(
ApiForm
form
)
{
return
ApiUtils
.
toApiResp
(
form
,
userFeign
.
sendCode
(
form
.
get
(
"phone"
)));
}
@Override
public
ApiResp
resetPassword
(
ApiForm
form
)
{
return
ApiUtils
.
toApiResp
(
form
,
userFeign
.
resetPassword
(
form
.
getParamsMap
()));
}
@Override
public
ApiResp
phoneLogin
(
ApiForm
form
)
{
return
ApiUtils
.
toApiResp
(
form
,
userFeign
.
phoneLogin
(
form
.
getParamsMap
()));
}
@Override
public
ApiResp
passwdLogin
(
ApiForm
form
)
{
return
ApiUtils
.
toApiResp
(
form
,
userFeign
.
passwdLogin
(
form
.
getParamsMap
()));
}
@Override
public
ApiResp
getMarriageStats
(
ApiForm
form
)
{
return
ApiUtils
.
toApiResp
(
form
,
portalFeign
.
getMarriageStats
(
form
.
getParamsMap
()));
}
@Override
public
ApiResp
getAreaUnderMarriageStatsList
(
ApiForm
form
)
{
return
ApiUtils
.
toApiResp
(
form
,
portalFeign
.
getAreaUnderMarriageStatsList
(
form
.
getParamsMap
()));
}
@Override
public
ApiResp
te
st
(
ApiForm
form
)
{
return
ApiUtils
.
toApiResp
(
form
,
ResultVo
.
success
(
));
public
ApiResp
getChildAreaLi
st
(
ApiForm
form
)
{
return
ApiUtils
.
toApiResp
(
form
,
portalFeign
.
getChildAreaList
(
form
.
get
(
"areaCode"
)
));
}
}
common-utils/src/main/java/com/zq/common/config/base/UnifiedExceptionHandler.java
View file @
670439a5
package
com
.
zq
.
common
.
config
.
base
;
import
com.zq.common.exception.BusinessException
;
import
com.zq.common.utils.ThrowableUtil
;
import
com.zq.common.vo.ResultVo
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
...
...
@@ -93,15 +94,21 @@ public class UnifiedExceptionHandler {
@ExceptionHandler
(
DataAccessException
.
class
)
public
ResultVo
handleDataAccessException
(
DataAccessException
ex
,
HttpServletRequest
request
)
{
log
.
error
(
">> 访问数据失败 "
+
request
.
getRequestURI
(),
ex
);
// log.info(">> 访问参数QueryString:" + ServletUtil.getParamMap(request));
// log.info(">> 访问参数body:" + ServletUtil.getBody(request));
return
ResultVo
.
fail
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
(),
"服务器繁忙"
);
String
error
=
"服务器繁忙"
;
if
(
request
.
getRequestURI
().
contains
(
"/app/"
))
{
error
=
ThrowableUtil
.
getStackTrace
(
ex
);
}
return
ResultVo
.
fail
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
(),
error
);
}
@ExceptionHandler
(
value
=
Exception
.
class
)
public
ResultVo
defaultErrorHandler
(
Exception
ex
,
HttpServletRequest
request
)
{
log
.
error
(
">> 服务器内部错误 "
+
request
.
getRequestURI
(),
ex
);
return
ResultVo
.
fail
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
(),
"服务器繁忙"
);
String
error
=
"服务器繁忙"
;
if
(
request
.
getRequestURI
().
contains
(
"/app/"
))
{
error
=
ThrowableUtil
.
getStackTrace
(
ex
);
}
return
ResultVo
.
fail
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
(),
error
);
}
}
\ No newline at end of file
}
portal-server/src/main/java/com/zq/portal/config
/DBName.java
→
common-utils/src/main/java/com/zq/common/constant
/DBName.java
View file @
670439a5
package
com
.
zq
.
portal
.
config
;
package
com
.
zq
.
common
.
constant
;
public
class
DBName
{
public
final
static
String
MASTER
=
"master"
;
...
...
common-utils/src/main/java/com/zq/common/entity/AppUser.java
View file @
670439a5
...
...
@@ -49,9 +49,9 @@ public class AppUser {
private
String
dealpwd
;
/**
* 用户类型
1普通用户 2消卷员
* 用户类型
*/
@ApiModelProperty
(
"用户类型
1普通用户 2消卷员
"
)
@ApiModelProperty
(
"用户类型 "
)
private
Integer
userType
;
/**
...
...
@@ -91,9 +91,9 @@ public class AppUser {
private
String
address
;
/**
* 状态:0
未激活 1正常 2暂停使用 3永久停号
* 状态:0
正常 1冻结 2删除
*/
@ApiModelProperty
(
"状态:0
未激活 1正常 2暂停使用 3永久停号
"
)
@ApiModelProperty
(
"状态:0
正常 1冻结 2删除
"
)
private
Integer
status
;
/**
...
...
common-utils/src/main/java/com/zq/common/entity/V
AreaMarriageStat
s.java
→
common-utils/src/main/java/com/zq/common/entity/V
Demographic
s.java
View file @
670439a5
...
...
@@ -9,21 +9,18 @@ import lombok.Builder;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
*
地区婚姻统计(TMrcaseStat
s)实体类
*
(VDemographic
s)实体类
*
* @author makejava
* @since 2021-06-24
09:56:48
* @since 2021-06-24
19:25:30
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName
(
value
=
"v_
area_marriage_stat
s"
)
public
class
V
AreaMarriageStat
s
{
@TableName
(
value
=
"v_
demographic
s"
)
public
class
V
Demographic
s
{
/**
* id
...
...
@@ -32,44 +29,27 @@ public class VAreaMarriageStats {
private
Long
id
;
/**
* 区域码
*/
@ApiModelProperty
(
"区域码"
)
private
String
areaCode
;
/**
* 区域名
*/
@ApiModelProperty
(
"区域名"
)
private
String
areaName
;
/**
* 结婚人数
*/
@ApiModelProperty
(
"结婚人数"
)
private
Integer
iaNum
;
/**
* 离婚人数
* 年份
*/
@ApiModelProperty
(
"
离婚人数
"
)
private
Integer
ibNum
;
@ApiModelProperty
(
"
年份
"
)
private
String
year
;
/**
*
补领结婚证人数
*
总人口
*/
@ApiModelProperty
(
"
补领结婚证人数
"
)
private
Integer
ica
Num
;
@ApiModelProperty
(
"
总人口
"
)
private
String
total
Num
;
/**
*
补领离婚证人数
*
出生人口
*/
@ApiModelProperty
(
"
补领离婚证人数
"
)
private
Integer
icb
Num
;
@ApiModelProperty
(
"
出生人口
"
)
private
String
born
Num
;
/**
*
createTime
*
死亡人口
*/
private
Date
createTime
;
@ApiModelProperty
(
"死亡人口"
)
private
String
deathNum
;
}
common-utils/src/main/java/com/zq/common/entity/VMarriageStats.java
View file @
670439a5
...
...
@@ -28,6 +28,18 @@ public class VMarriageStats {
private
Long
id
;
/**
* 区域码
*/
@ApiModelProperty
(
"区域码"
)
private
String
areaCode
;
/**
* 区域名
*/
@ApiModelProperty
(
"区域名"
)
private
String
areaName
;
/**
* 结婚人数
*/
@ApiModelProperty
(
"结婚人数"
)
...
...
@@ -58,6 +70,18 @@ public class VMarriageStats {
private
Integer
crossDivorceNum
;
/**
* 跨地区结婚人数
*/
@ApiModelProperty
(
"补领结婚证人数"
)
private
Integer
patchMarryCaNum
;
/**
* 补领离婚证人数
*/
@ApiModelProperty
(
"补领离婚证人数"
)
private
Integer
patchDivorceCaNum
;
/**
* createTime
*/
private
Date
createTime
;
...
...
portal-server/src/main/java/com/zq/portal/config/TokenFilter.java
View file @
670439a5
...
...
@@ -102,7 +102,7 @@ public class TokenFilter extends GenericFilterBean {
// 去掉令牌前缀
return
bearerToken
.
replace
(
properties
.
getTokenStartWith
(),
""
);
}
else
{
log
.
debug
(
"非法Token:{}
"
,
bearerToken
);
log
.
debug
(
"非法Token:{}
, {}"
,
request
.
getRequestURL
()
,
bearerToken
);
}
return
null
;
}
...
...
portal-server/src/main/java/com/zq/portal/controller/admin/DemographicsAdminController.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
portal
.
controller
.
admin
;
import
com.zq.common.config.redis.RedisUtils
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.portal.service.DemographicsService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
tags
=
"人口统计相关接口"
)
@RequiredArgsConstructor
@RestController
@RequestMapping
(
value
=
"/portal/admin/stats"
)
public
class
DemographicsAdminController
{
public
final
DemographicsService
demographicsService
;
public
final
RedisUtils
redisUtils
;
@ApiOperation
(
"获取人口统计走势图"
)
@GetMapping
(
value
=
"/getDemographicsLineData"
)
public
ResultVo
getDemographicsLineData
()
{
return
ResultVo
.
success
(
demographicsService
.
getDemographicsLineData
());
}
}
portal-server/src/main/java/com/zq/portal/controller/admin/HyAdminStatsController.java
deleted
100644 → 0
View file @
c0931429
package
com
.
zq
.
portal
.
controller
.
admin
;
import
cn.hutool.core.date.DateUtil
;
import
com.zq.common.annotation.AnonymousAccess
;
import
com.zq.common.config.redis.RedisUtils
;
import
com.zq.common.entity.VMarriageStats
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.portal.manager.CacheKeys
;
import
com.zq.portal.manager.PortalCacheManager
;
import
com.zq.portal.service.StatsService
;
import
com.zq.portal.vo.StatsReqVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
@Api
(
tags
=
"婚姻相关接口"
)
@RequiredArgsConstructor
@RestController
@RequestMapping
(
value
=
"/portal/admin/stats"
)
public
class
HyAdminStatsController
{
public
final
StatsService
statsService
;
public
final
RedisUtils
redisUtils
;
@ApiOperation
(
"获取结婚离婚人数"
)
@PostMapping
(
value
=
"/getTotalMarryDivorce"
)
public
ResultVo
getTotalMarryDivorce
(
@RequestBody
StatsReqVo
vo
)
{
return
ResultVo
.
success
(
statsService
.
getMarriageStats
(
vo
));
}
@AnonymousAccess
@ApiOperation
(
"获取地区结婚离婚人数列表"
)
@PostMapping
(
value
=
"/getAreaMarriageStatsList"
)
public
ResultVo
getAreaMarriageStatsList
(
@RequestBody
StatsReqVo
vo
)
{
Object
obj
=
redisUtils
.
getObj
(
CacheKeys
.
getAreaMarriageStatsListKey
(
vo
.
getAreaCode
()));
if
(
obj
!=
null
)
{
return
ResultVo
.
success
(
obj
);
}
return
ResultVo
.
success
(
statsService
.
getAreaMarriageStatsList
(
vo
));
}
@ApiOperation
(
"获取地区结婚离婚人数列表"
)
@PostMapping
(
value
=
"/getDivorceCoolingLine"
)
public
ResultVo
getDivorceCoolingLine
(
@RequestBody
StatsReqVo
vo
)
{
return
ResultVo
.
success
(
statsService
.
getDivorceCoolingLine
(
vo
));
}
}
portal-server/src/main/java/com/zq/portal/controller/admin/HyStatsAdminController.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
portal
.
controller
.
admin
;
import
com.zq.common.entity.VMarriageStats
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.portal.service.HyStatsService
;
import
com.zq.portal.vo.StatsReqVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@Api
(
tags
=
"婚姻相关接口"
)
@RequiredArgsConstructor
@RestController
@RequestMapping
(
value
=
"/portal/admin/stats"
)
public
class
HyStatsAdminController
{
public
final
HyStatsService
hyStatsService
;
@ApiOperation
(
"获取结婚离婚人数"
)
@PostMapping
(
value
=
"/getMarriageStats"
)
public
ResultVo
<
VMarriageStats
>
getMarriageStats
(
@RequestBody
StatsReqVo
vo
)
{
return
ResultVo
.
success
(
hyStatsService
.
getCacheMarriageStats
(
vo
));
}
@ApiOperation
(
"获取地区结婚离婚人数列表"
)
@PostMapping
(
value
=
"/getAreaUnderMarriageStatsList"
)
public
ResultVo
<
List
<
VMarriageStats
>>
getAreaUnderMarriageStatsList
(
@RequestBody
StatsReqVo
vo
)
{
return
ResultVo
.
success
(
hyStatsService
.
getCacheAreaUnderMarriageStatsList
(
vo
));
}
@ApiOperation
(
"获取近5年结婚离婚走势"
)
@PostMapping
(
value
=
"/getMarryPerYear"
)
public
ResultVo
getMarryPerYear
(
@RequestBody
StatsReqVo
vo
)
{
return
ResultVo
.
success
(
hyStatsService
.
getCacheMarryPerYear
(
vo
));
}
// @ApiOperation("获取地区结婚离婚人数列表")
// @PostMapping(value = "/getDivorceCoolingLine")
// public ResultVo getDivorceCoolingLine(@RequestBody StatsReqVo vo) {
// return ResultVo.success(hyStatsService.getDivorceCoolingLine(vo));
// }
}
portal-server/src/main/java/com/zq/portal/controller/admin/StatsAdminController.java
View file @
670439a5
...
...
@@ -7,14 +7,10 @@ import com.zq.portal.feign.StatsServerFeignClient;
import
com.zq.portal.manager.PortalCacheManager
;
import
com.zq.portal.service.DatabaseInfoService
;
import
com.zq.portal.service.PeopleService
;
import
com.zq.portal.service.StatsService
;
import
com.zq.portal.vo.AreaVo
;
import
com.zq.portal.vo.IdVo
;
import
com.zq.portal.vo.StatsReqVo
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.lang3.StringUtils
;
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
;
...
...
@@ -28,7 +24,6 @@ public class StatsAdminController {
private
final
PeopleService
peopleService
;
private
final
PortalCacheManager
cacheManager
;
private
final
DatabaseInfoService
databaseInfoService
;
private
final
StatsService
statsService
;
/**
* 市业务详情图
...
...
portal-server/src/main/java/com/zq/portal/controller/app/AreaController.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
portal
.
controller
.
app
;
import
com.zq.common.context.ContextUtils
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.portal.service.AreaService
;
import
io.swagger.annotations.Api
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
tags
=
"区域相关接口"
)
@RequiredArgsConstructor
@RestController
@RequestMapping
(
value
=
"/portal/app/area"
)
public
class
AreaController
{
private
final
AreaService
areaService
;
@GetMapping
(
value
=
"/getChildAreaList"
)
public
ResultVo
getChildAreaList
(
@RequestParam
String
areaCode
)
{
return
ResultVo
.
success
(
areaService
.
getChildAreaList
(
areaCode
));
}
}
portal-server/src/main/java/com/zq/portal/controller/app/BzStatsController.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
portal
.
controller
.
app
;
import
com.zq.common.config.redis.RedisUtils
;
import
com.zq.portal.service.BzStatsService
;
import
com.zq.portal.service.HyStatsService
;
import
io.swagger.annotations.Api
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
tags
=
"统计相关接口"
)
@RequiredArgsConstructor
@RestController
@RequestMapping
(
value
=
"/portal/app/stats"
)
public
class
BzStatsController
{
public
final
BzStatsService
bzStatsService
;
public
final
RedisUtils
redisUtils
;
}
portal-server/src/main/java/com/zq/portal/controller/app/CjStatsController.java
View file @
670439a5
package
com
.
zq
.
portal
.
controller
.
app
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.portal.service.StatsService
;
import
com.zq.portal.service.
Cj
StatsService
;
import
com.zq.portal.vo.StatsReqVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -17,12 +17,12 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping
(
value
=
"/portal/app/stats"
)
public
class
CjStatsController
{
public
final
StatsService
s
tatsService
;
public
final
CjStatsService
cjS
tatsService
;
@ApiOperation
(
"残疾人两项补贴"
)
@PostMapping
(
value
=
"/cjTwoSubsidies"
)
public
ResultVo
cjTwoSubsidies
(
@RequestBody
StatsReqVo
vo
)
{
return
ResultVo
.
success
(
s
tatsService
.
cjTwoSubsidies
(
vo
));
return
ResultVo
.
success
(
cjS
tatsService
.
cjTwoSubsidies
(
vo
));
}
}
portal-server/src/main/java/com/zq/portal/controller/app/HyStatsController.java
View file @
670439a5
package
com
.
zq
.
portal
.
controller
.
app
;
import
com.zq.common.entity.VMarriageStats
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.portal.manager.CacheKeys
;
import
com.zq.portal.manager.PortalCacheManager
;
import
com.zq.portal.service.StatsService
;
import
com.zq.portal.service.HyStatsService
;
import
com.zq.portal.vo.StatsReqVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -13,29 +12,32 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@Api
(
tags
=
"婚姻相关接口"
)
@RequiredArgsConstructor
@RestController
@RequestMapping
(
value
=
"/portal/app/stats"
)
public
class
HyStatsController
{
public
final
StatsService
statsService
;
public
final
PortalCacheManager
cacheManager
;
public
final
HyStatsService
hyStatsService
;
@ApiOperation
(
"获取结婚离婚人数"
)
@PostMapping
(
value
=
"/getTotalMarryDivorce"
)
public
ResultVo
getTotalMarryDivorce
(
@RequestBody
StatsReqVo
vo
)
{
return
ResultVo
.
success
(
statsService
.
getMarriageStats
(
vo
));
@PostMapping
(
value
=
"/getMarriageStats"
)
public
ResultVo
<
VMarriageStats
>
getMarriageStats
(
@RequestBody
StatsReqVo
vo
)
{
return
ResultVo
.
success
(
hyStatsService
.
getCacheMarriageStats
(
vo
));
}
@ApiOperation
(
"获取地区下面婚姻统计列表"
)
@PostMapping
(
value
=
"/getAreaUnderMarriageStatsList"
)
public
ResultVo
<
List
<
VMarriageStats
>>
getAreaUnderMarriageStatsList
(
@RequestBody
StatsReqVo
vo
)
{
return
ResultVo
.
success
(
hyStatsService
.
getCacheAreaUnderMarriageStatsList
(
vo
));
}
@ApiOperation
(
"获取地区结婚离婚人数列表"
)
@PostMapping
(
value
=
"/getAreaMarriageStatsList"
)
public
ResultVo
getAreaMarriageStatsList
(
@RequestBody
StatsReqVo
vo
)
{
Object
obj
=
cacheManager
.
getObj
(
CacheKeys
.
getAreaMarriageStatsListKey
(
vo
.
getAreaCode
()));
if
(
obj
!=
null
)
{
return
ResultVo
.
success
(
obj
);
}
return
ResultVo
.
success
(
statsService
.
getAreaMarriageStatsList
(
vo
));
@ApiOperation
(
"获取近5年结婚离婚走势"
)
@PostMapping
(
value
=
"/getMarryPerYear"
)
public
ResultVo
getMarryPerYear
(
@RequestBody
StatsReqVo
vo
)
{
return
ResultVo
.
success
(
hyStatsService
.
getCacheMarryPerYear
(
vo
));
}
}
portal-server/src/main/java/com/zq/portal/controller/app/ShzzStatsController.java
View file @
670439a5
package
com
.
zq
.
portal
.
controller
.
app
;
import
com.zq.portal.service.StatsService
;
import
com.zq.portal.service.S
hzzS
tatsService
;
import
io.swagger.annotations.Api
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -12,6 +12,6 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping
(
value
=
"/portal/app/stats"
)
public
class
ShzzStatsController
{
public
final
S
tatsService
s
tatsService
;
public
final
S
hzzStatsService
shzzS
tatsService
;
}
portal-server/src/main/java/com/zq/portal/controller/app/StatsController.java
deleted
100644 → 0
View file @
c0931429
package
com
.
zq
.
portal
.
controller
.
app
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.portal.manager.CacheKeys
;
import
com.zq.portal.manager.PortalCacheManager
;
import
com.zq.portal.service.StatsService
;
import
com.zq.portal.vo.StatsReqVo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
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
;
@Api
(
tags
=
"统计相关接口"
)
@RequiredArgsConstructor
@RestController
@RequestMapping
(
value
=
"/portal/app/stats"
)
public
class
StatsController
{
public
final
StatsService
statsService
;
public
final
PortalCacheManager
portalCacheManager
;
@ApiOperation
(
"获取地图统计数据"
)
@PostMapping
(
value
=
"/getMapStatsData"
)
public
ResultVo
getMapStatsData
(
@RequestBody
StatsReqVo
vo
)
{
Object
obj
=
portalCacheManager
.
getObj
(
CacheKeys
.
getMapDataKey
(
vo
.
getAreaCode
()));
if
(
obj
!=
null
)
{
return
ResultVo
.
success
(
obj
);
}
return
ResultVo
.
success
(
statsService
.
getMapStatsData
(
vo
));
}
}
portal-server/src/main/java/com/zq/portal/dao/BzStatsDao.java
View file @
670439a5
package
com
.
zq
.
portal
.
dao
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.zq.
portal.config
.DBName
;
import
com.zq.
common.constant
.DBName
;
import
com.zq.portal.vo.StatsVo
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
...
...
portal-server/src/main/java/com/zq/portal/dao/CjStatsDao.java
View file @
670439a5
package
com
.
zq
.
portal
.
dao
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.zq.
portal.config
.DBName
;
import
com.zq.
common.constant
.DBName
;
import
org.springframework.stereotype.Repository
;
@DS
(
DBName
.
GXCJ
)
...
...
portal-server/src/main/java/com/zq/portal/dao/DbStatsDao.java
View file @
670439a5
package
com
.
zq
.
portal
.
dao
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.zq.portal.config.DBName
;
import
com.zq.portal.vo.StatsVo
;
import
com.zq.common.constant.DBName
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@DS
(
DBName
.
GXDB
)
@Repository
public
interface
DbStatsDao
{
...
...
portal-server/src/main/java/com/zq/portal/dao/HyStatsDao.java
View file @
670439a5
package
com
.
zq
.
portal
.
dao
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.zq.
portal.config
.DBName
;
import
com.zq.
common.constant
.DBName
;
import
com.zq.portal.vo.StatsReqVo
;
import
com.zq.portal.vo.StatsVo
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -14,18 +14,33 @@ import java.util.List;
public
interface
HyStatsDao
{
/**
* 获取近5年的折线
*
* @return
*/
List
<
StatsVo
>
getMarryPerYear
(
@Param
(
"type"
)
String
type
);
/**
* 获取结婚离婚人数
*
* @param vo
* @return
*/
List
<
StatsVo
>
getTotalMarryDivorce
(
StatsReqVo
vo
);
List
<
StatsVo
>
getMarriageStats
(
StatsReqVo
vo
);
/**
* 获取跨地结婚离婚人数
*
* @param vo
* @return
*/
List
<
StatsVo
>
getCrossMarriageStats
(
StatsReqVo
vo
);
// 获取结婚人数
StatsVo
getMarryNum
(
@Param
(
"areaCode"
)
String
areaCode
,
@Param
(
"year"
)
String
year
);
StatsVo
getMarryNum
(
StatsReqVo
vo
);
// 获取离婚人数
StatsVo
get
DivorceNum
(
@Param
(
"subAreaCode"
)
String
subAreaCode
,
@Param
(
"year"
)
String
year
);
// 获取离婚
中的
人数
StatsVo
get
InDivorceNum
(
StatsReqVo
vo
);
// 获取每月冷静期数据
List
<
StatsVo
>
getMonthDivorceCoolingData
(
StatsReqVo
vo
);
...
...
portal-server/src/main/java/com/zq/portal/dao/ShzzStatsDao.java
View file @
670439a5
package
com
.
zq
.
portal
.
dao
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.zq.
portal.config
.DBName
;
import
com.zq.
common.constant
.DBName
;
import
com.zq.portal.vo.StatsVo
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
...
...
portal-server/src/main/java/com/zq/portal/dao/V
AreaMarriageStat
sDao.java
→
portal-server/src/main/java/com/zq/portal/dao/V
Demographic
sDao.java
View file @
670439a5
package
com
.
zq
.
portal
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.zq.common.entity.V
AreaMarriageStat
s
;
import
com.zq.common.entity.V
Demographic
s
;
import
org.springframework.stereotype.Repository
;
/**
*
地区婚姻统计(TMrcaseStat
s)表数据库访问层
*
(VDemographic
s)表数据库访问层
*
* @author makejava
* @since 2021-06-24 1
0:04:2
2
* @since 2021-06-24 1
9:26:4
2
*/
@Repository
public
interface
V
AreaMarriageStatsDao
extends
BaseMapper
<
VAreaMarriageStat
s
>
{
public
interface
V
DemographicsDao
extends
BaseMapper
<
VDemographic
s
>
{
}
portal-server/src/main/java/com/zq/portal/manager/CacheKeys.java
View file @
670439a5
...
...
@@ -12,4 +12,11 @@ public abstract class CacheKeys {
return
PREFIX
+
"AreaMarriageStatsList."
+
areaCode
;
}
public
static
String
getMarriageStatsKey
(
String
areaCode
)
{
return
PREFIX
+
"MarriageStats."
+
areaCode
;
}
public
static
String
getMarryPerYearKey
()
{
return
PREFIX
+
"MarryPerYear"
;
}
}
portal-server/src/main/java/com/zq/portal/service/AreaService.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
portal
.
service
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.zq.common.entity.SystemArea
;
import
com.zq.portal.dao.AreaDao
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
@Service
@RequiredArgsConstructor
public
class
AreaService
{
private
final
AreaDao
areaDao
;
public
Object
getChildAreaList
(
String
areaCode
)
{
return
areaDao
.
selectList
(
Wrappers
.
lambdaQuery
(
SystemArea
.
builder
().
parentId
(
areaCode
).
build
()));
}
}
portal-server/src/main/java/com/zq/portal/service/BzStatsService.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
portal
.
service
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
@Service
@RequiredArgsConstructor
public
class
BzStatsService
{
}
portal-server/src/main/java/com/zq/portal/service/CjStatsService.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
portal
.
service
;
import
com.zq.common.config.redis.RedisUtils
;
import
com.zq.common.entity.SystemArea
;
import
com.zq.common.utils.StringUtils
;
import
com.zq.portal.dao.AreaDao
;
import
com.zq.portal.vo.StatsReqVo
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
@Service
@RequiredArgsConstructor
public
class
CjStatsService
{
private
final
AreaDao
areaDao
;
private
final
RedisUtils
redisUtils
;
public
Object
cjTwoSubsidies
(
StatsReqVo
vo
)
{
if
(
StringUtils
.
isBlank
(
vo
.
getAreaCode
()))
{
vo
.
setAreaCode
(
"450000000000"
);
}
SystemArea
systemArea
=
areaDao
.
selectById
(
vo
.
getAreaCode
());
return
null
;
}
}
portal-server/src/main/java/com/zq/portal/service/DemographicsService.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
portal
.
service
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.zq.common.entity.VDemographics
;
import
com.zq.portal.dao.VDemographicsDao
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
@Service
@RequiredArgsConstructor
public
class
DemographicsService
{
private
final
VDemographicsDao
vDemographicsDao
;
public
Object
getDemographicsLineData
()
{
List
<
VDemographics
>
vDemographics
=
vDemographicsDao
.
selectList
(
Wrappers
.
lambdaQuery
(
VDemographics
.
class
).
orderByDesc
(
VDemographics:
:
getYear
).
last
(
"LIMIT 5"
));
vDemographics
.
sort
(
Comparator
.
comparing
(
VDemographics:
:
getYear
));
List
<
String
>
dateList
=
new
ArrayList
<>();
List
<
String
>
totalList
=
new
ArrayList
<>();
List
<
String
>
bornList
=
new
ArrayList
<>();
for
(
VDemographics
vDemographic
:
vDemographics
)
{
dateList
.
add
(
vDemographic
.
getYear
());
totalList
.
add
(
vDemographic
.
getTotalNum
());
bornList
.
add
(
vDemographic
.
getBornNum
());
}
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"dateList"
,
dateList
);
data
.
put
(
"totalList"
,
totalList
);
data
.
put
(
"bornList"
,
bornList
);
return
data
;
}
}
portal-server/src/main/java/com/zq/portal/service/HyStatsService.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
portal
.
service
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.zq.common.config.redis.RedisUtils
;
import
com.zq.common.entity.SystemArea
;
import
com.zq.common.entity.VMarriageStats
;
import
com.zq.common.utils.StringUtils
;
import
com.zq.portal.dao.AreaDao
;
import
com.zq.portal.dao.HyStatsDao
;
import
com.zq.portal.dao.VMarriageStatsDao
;
import
com.zq.portal.manager.CacheKeys
;
import
com.zq.portal.vo.LineDataVo
;
import
com.zq.portal.vo.StatsReqVo
;
import
com.zq.portal.vo.StatsVo
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
@Service
@RequiredArgsConstructor
public
class
HyStatsService
{
private
final
HyStatsDao
hyStatsDao
;
private
final
AreaDao
areaDao
;
private
final
VMarriageStatsDao
vMarriageStatsDao
;
private
final
RedisUtils
redisUtils
;
/**
* 获取缓存婚姻统计
*
* @param vo
* @return
*/
public
VMarriageStats
getCacheMarriageStats
(
StatsReqVo
vo
)
{
Object
obj
=
redisUtils
.
getObj
(
CacheKeys
.
getMarriageStatsKey
(
vo
.
getAreaCode
()
+
vo
.
getStartTime
()
+
vo
.
getEndTime
()));
if
(
obj
!=
null
)
{
return
(
VMarriageStats
)
obj
;
}
return
getMarriageStats
(
vo
);
}
/**
* 婚姻统计
*
* @param vo
* @return
*/
public
VMarriageStats
getMarriageStats
(
StatsReqVo
vo
)
{
String
marriageStatsKey
=
CacheKeys
.
getMarriageStatsKey
(
vo
.
getAreaCode
()
+
vo
.
getStartTime
()
+
vo
.
getEndTime
());
if
(
StrUtil
.
isNotBlank
(
vo
.
getStartTime
()))
{
vo
.
setStartTime
(
vo
.
getStartTime
()
+
"-01-01 00:00:00"
);
}
if
(
StrUtil
.
isNotBlank
(
vo
.
getEndTime
()))
{
vo
.
setEndTime
(
DateUtil
.
endOfYear
(
DateUtil
.
parseDateTime
(
vo
.
getEndTime
()
+
"-01-01 00:00:00"
)).
toStringDefaultTimeZone
());
}
if
(
StringUtils
.
isBlank
(
vo
.
getAreaCode
()))
{
vo
.
setAreaCode
(
"450000000000"
);
}
SystemArea
area
=
areaDao
.
getAreaByCode
(
vo
.
getAreaCode
());
vo
.
setAreaCode
(
area
.
subAreaCode
());
// 统计实体
VMarriageStats
build
=
VMarriageStats
.
builder
()
.
areaCode
(
area
.
getCode
())
.
areaName
(
area
.
getName
())
.
createTime
(
DateUtil
.
parseDate
(
DateUtil
.
today
()))
.
build
();
// 结婚 离婚 补领结婚证 补领离婚证
List
<
StatsVo
>
marriageStatsList
=
hyStatsDao
.
getMarriageStats
(
vo
);
for
(
StatsVo
statsVo
:
marriageStatsList
)
{
if
(
"IA"
.
equals
(
statsVo
.
getType
()))
{
build
.
setMarryNum
(
statsVo
.
getNum
());
}
else
if
(
"IB"
.
equals
(
statsVo
.
getType
()))
{
build
.
setDivorceNum
(
statsVo
.
getNum
());
}
else
if
(
"ICA"
.
equals
(
statsVo
.
getType
()))
{
build
.
setPatchMarryCaNum
(
statsVo
.
getNum
());
}
else
if
(
"ICB"
.
equals
(
statsVo
.
getType
()))
{
build
.
setPatchDivorceCaNum
(
statsVo
.
getNum
());
}
}
// 获取离婚中的人数
StatsVo
inDivorceNum
=
hyStatsDao
.
getInDivorceNum
(
vo
);
build
.
setInDivorceNum
(
inDivorceNum
.
getNum
());
// 获取跨地结婚离婚人数
List
<
StatsVo
>
crossMarriageStats
=
hyStatsDao
.
getCrossMarriageStats
(
vo
);
for
(
StatsVo
crossMarriageStat
:
crossMarriageStats
)
{
if
(
"IA"
.
equals
(
crossMarriageStat
.
getType
()))
{
build
.
setCrossMarryNum
(
crossMarriageStat
.
getNum
());
}
else
if
(
"IB"
.
equals
(
crossMarriageStat
.
getType
()))
{
build
.
setCrossDivorceNum
(
crossMarriageStat
.
getNum
());
}
}
// 放进缓存
if
(
StrUtil
.
isNotBlank
(
vo
.
getStartTime
())
||
StrUtil
.
isNotBlank
(
vo
.
getEndTime
()))
{
// 有时间条件的设置过期时间避免内存暂用
redisUtils
.
setObj
(
marriageStatsKey
,
build
,
1
,
TimeUnit
.
DAYS
);
}
else
{
redisUtils
.
setObj
(
marriageStatsKey
,
build
);
}
// 放进数据库 有时间条件的不存库
VMarriageStats
marriageStats
=
vMarriageStatsDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
VMarriageStats
.
builder
().
areaCode
(
area
.
getCode
()).
createTime
(
DateUtil
.
parseDate
(
DateUtil
.
today
())).
build
()));
if
(
marriageStats
==
null
&&
StrUtil
.
isBlank
(
vo
.
getStartTime
())
&&
StrUtil
.
isBlank
(
vo
.
getEndTime
()))
{
vMarriageStatsDao
.
insert
(
build
);
}
return
build
;
}
/**
* 获取缓存区域下的结婚离婚数据
*
* @param vo
* @return
*/
public
List
<
VMarriageStats
>
getCacheAreaUnderMarriageStatsList
(
StatsReqVo
vo
)
{
Object
obj
=
redisUtils
.
getObj
(
CacheKeys
.
getAreaMarriageStatsListKey
(
vo
.
getAreaCode
()
+
vo
.
getStartTime
()
+
vo
.
getEndTime
()));
if
(
obj
!=
null
)
{
return
(
List
<
VMarriageStats
>)
obj
;
}
return
getAreaUnderMarriageStatsList
(
vo
);
}
/**
* 获取区域下的结婚离婚数据
*
* @param vo
* @return
*/
public
List
<
VMarriageStats
>
getAreaUnderMarriageStatsList
(
StatsReqVo
vo
)
{
String
areaMarriageStatsListKey
=
CacheKeys
.
getAreaMarriageStatsListKey
(
vo
.
getAreaCode
()
+
vo
.
getStartTime
()
+
vo
.
getEndTime
());
if
(
StringUtils
.
isBlank
(
vo
.
getAreaCode
()))
{
vo
.
setAreaCode
(
"450000000000"
);
}
List
<
VMarriageStats
>
returnData
=
new
ArrayList
<>();
List
<
SystemArea
>
systemAreaList
=
areaDao
.
selectList
(
Wrappers
.
lambdaQuery
(
SystemArea
.
builder
().
parentId
(
vo
.
getAreaCode
()).
build
()));
for
(
SystemArea
systemArea
:
systemAreaList
)
{
vo
.
setAreaCode
(
systemArea
.
getCode
());
returnData
.
add
(
getMarriageStats
(
vo
));
}
if
(
StrUtil
.
isNotBlank
(
vo
.
getStartTime
())
||
StrUtil
.
isNotBlank
(
vo
.
getEndTime
()))
{
// 搜索的有过期时间避免内存暂用
redisUtils
.
setObj
(
areaMarriageStatsListKey
,
returnData
,
1
,
TimeUnit
.
DAYS
);
}
else
{
redisUtils
.
setObj
(
areaMarriageStatsListKey
,
returnData
);
}
return
returnData
;
}
/**
* 获取冷静期和真正离婚的折线图数据
*
* @param vo
* @return
*/
public
Object
getDivorceCoolingLine
(
StatsReqVo
vo
)
{
// 获取冷静期
List
<
StatsVo
>
statsVoList
=
hyStatsDao
.
getMonthDivorceCoolingData
(
vo
);
return
null
;
}
/**
* 缓存获取近5年结婚离婚走势
*
* @param vo
* @return
*/
public
Object
getCacheMarryPerYear
(
StatsReqVo
vo
)
{
Object
obj
=
redisUtils
.
getObj
(
CacheKeys
.
getMarryPerYearKey
());
if
(
obj
!=
null
)
{
return
obj
;
}
return
getMarryPerYear
(
vo
);
}
/**
* 获取近5年结婚离婚走势
*
* @param vo
* @return
*/
public
Object
getMarryPerYear
(
StatsReqVo
vo
)
{
List
<
StatsVo
>
ia
=
hyStatsDao
.
getMarryPerYear
(
"IA"
);
ia
.
sort
(
Comparator
.
comparing
(
StatsVo:
:
getYear
));
List
<
String
>
iaDateList
=
new
ArrayList
<>();
List
<
String
>
iaAmountList
=
new
ArrayList
<>();
ia
.
forEach
(
statsVo
->
{
iaDateList
.
add
(
statsVo
.
getYear
());
iaAmountList
.
add
(
String
.
valueOf
(
statsVo
.
getNum
()));
});
LineDataVo
iaLineData
=
LineDataVo
.
builder
().
dateList
(
iaDateList
).
amountList
(
iaAmountList
).
build
();
List
<
StatsVo
>
ib
=
hyStatsDao
.
getMarryPerYear
(
"IB"
);
ib
.
sort
(
Comparator
.
comparing
(
StatsVo:
:
getYear
));
List
<
String
>
ibDateList
=
new
ArrayList
<>();
List
<
String
>
ibAmountList
=
new
ArrayList
<>();
ib
.
forEach
(
statsVo
->
{
ibDateList
.
add
(
statsVo
.
getYear
());
ibAmountList
.
add
(
String
.
valueOf
(
statsVo
.
getNum
()));
});
LineDataVo
ibLineData
=
LineDataVo
.
builder
().
dateList
(
ibDateList
).
amountList
(
ibAmountList
).
build
();
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"iaLineData"
,
iaLineData
);
data
.
put
(
"ibLineData"
,
ibLineData
);
redisUtils
.
setObj
(
CacheKeys
.
getMarryPerYearKey
(),
data
);
return
data
;
}
}
portal-server/src/main/java/com/zq/portal/service/ShzzStatsService.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
portal
.
service
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
@Service
@RequiredArgsConstructor
public
class
ShzzStatsService
{
}
portal-server/src/main/java/com/zq/portal/service/StatsService.java
deleted
100644 → 0
View file @
c0931429
package
com
.
zq
.
portal
.
service
;
import
cn.hutool.core.date.DateUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.zq.common.config.redis.RedisUtils
;
import
com.zq.common.entity.VAreaMarriageStats
;
import
com.zq.common.entity.SystemArea
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.utils.StringUtils
;
import
com.zq.portal.dao.*
;
import
com.zq.portal.manager.CacheKeys
;
import
com.zq.portal.manager.PortalCacheManager
;
import
com.zq.portal.vo.StatsReqVo
;
import
com.zq.portal.vo.StatsVo
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
@RequiredArgsConstructor
public
class
StatsService
{
private
final
BzStatsDao
bzStatsDao
;
private
final
HyStatsDao
hyStatsDao
;
private
final
ShzzStatsDao
shzzStatsDao
;
private
final
AreaDao
areaDao
;
private
final
VAreaMarriageStatsDao
vAreaMarriageStatsDao
;
private
final
RedisUtils
redisUtils
;
public
Object
getMapStatsData
(
StatsReqVo
vo
)
{
List
<
Map
<
String
,
Object
>>
returnData
=
new
ArrayList
<>();
//获取子区域
List
<
SystemArea
>
kid
=
areaDao
.
findKid
(
vo
.
getAreaCode
());
AssertUtils
.
isTrue
(
kid
!=
null
&&
kid
.
size
()
>
0
,
"该地区没有数据"
);
for
(
SystemArea
systemArea
:
kid
)
{
// 区域数据
Map
<
String
,
Object
>
areaData
=
new
HashMap
<>();
String
areaCode
=
systemArea
.
subAreaCode
();
// 每年死亡人数
List
<
StatsVo
>
deathsPerYear
=
bzStatsDao
.
getDeathsPerYear
(
areaCode
);
// 每年结婚人数
// List<YearStatsVo> marryPerYear = hyStatsDao.getMarryPerYear(areaCode);
// 每年社会组织数量
List
<
StatsVo
>
soorganPerYear
=
shzzStatsDao
.
getSoorganPerYear
(
areaCode
);
areaData
.
put
(
"deathsPerYear"
,
deathsPerYear
);
// areaData.put("marryPerYear", marryPerYear);
areaData
.
put
(
"soorganPerYear"
,
soorganPerYear
);
areaData
.
put
(
"areaName"
,
systemArea
.
getName
());
areaData
.
put
(
"areaCode"
,
systemArea
.
getCode
());
returnData
.
add
(
areaData
);
}
if
(
returnData
.
size
()
>
0
)
{
redisUtils
.
setObj
(
CacheKeys
.
getMapDataKey
(
vo
.
getAreaCode
()),
returnData
);
}
return
returnData
;
}
/**
* 婚姻统计
*
* @param vo
* @return
*/
public
Object
getMarriageStats
(
StatsReqVo
vo
)
{
if
(
StringUtils
.
isBlank
(
vo
.
getAreaCode
()))
{
vo
.
setAreaCode
(
"450000000000"
);
}
SystemArea
area
=
areaDao
.
getAreaByCode
(
vo
.
getAreaCode
());
vo
.
setAreaCode
(
area
.
subAreaCode
());
List
<
StatsVo
>
totalMarryDivorce
=
hyStatsDao
.
getTotalMarryDivorce
(
vo
);
return
totalMarryDivorce
;
}
/**
* 获取区域下的结婚离婚数据
*
* @param vo
* @return
*/
public
Object
getAreaMarriageStatsList
(
StatsReqVo
vo
)
{
String
areaMarriageStatsListKey
=
CacheKeys
.
getAreaMarriageStatsListKey
(
vo
.
getAreaCode
());
if
(
StringUtils
.
isBlank
(
vo
.
getAreaCode
()))
{
vo
.
setAreaCode
(
"450000000000"
);
}
SystemArea
area
=
areaDao
.
getAreaByCode
(
vo
.
getAreaCode
());
vo
.
setAreaCode
(
area
.
subAreaCode
());
List
<
VAreaMarriageStats
>
returnData
=
new
ArrayList
<>();
List
<
SystemArea
>
systemAreaList
=
areaDao
.
selectList
(
Wrappers
.
lambdaQuery
(
SystemArea
.
builder
().
parentId
(
area
.
getCode
()).
build
()));
for
(
SystemArea
systemArea
:
systemAreaList
)
{
VAreaMarriageStats
vAreaMarriageStats
=
vAreaMarriageStatsDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
VAreaMarriageStats
.
builder
().
areaCode
(
systemArea
.
getCode
()).
createTime
(
DateUtil
.
parseDate
(
DateUtil
.
today
())).
build
()));
if
(
vAreaMarriageStats
==
null
)
{
vAreaMarriageStats
=
VAreaMarriageStats
.
builder
()
.
areaCode
(
systemArea
.
getCode
())
.
areaName
(
systemArea
.
getName
())
.
createTime
(
DateUtil
.
date
())
.
build
();
// 按结婚离婚分类统计
List
<
StatsVo
>
totalMarryDivorce
=
hyStatsDao
.
getTotalMarryDivorce
(
StatsReqVo
.
builder
().
areaCode
(
systemArea
.
subAreaCode
()).
build
());
for
(
StatsVo
statsVo
:
totalMarryDivorce
)
{
if
(
"IA"
.
equals
(
statsVo
.
getType
()))
{
vAreaMarriageStats
.
setIaNum
(
statsVo
.
getNum
());
}
else
if
(
"IB"
.
equals
(
statsVo
.
getType
()))
{
vAreaMarriageStats
.
setIbNum
(
statsVo
.
getNum
());
}
else
if
(
"ICA"
.
equals
(
statsVo
.
getType
()))
{
vAreaMarriageStats
.
setIcaNum
(
statsVo
.
getNum
());
}
else
if
(
"ICB"
.
equals
(
statsVo
.
getType
()))
{
vAreaMarriageStats
.
setIcbNum
(
statsVo
.
getNum
());
}
}
}
returnData
.
add
(
vAreaMarriageStats
);
}
redisUtils
.
setObj
(
areaMarriageStatsListKey
,
returnData
);
//添加统计到数据库
addVAreaMarriageStats
(
returnData
);
return
returnData
;
}
public
void
addVAreaMarriageStats
(
List
<
VAreaMarriageStats
>
vAreaMarriageStats
)
{
for
(
VAreaMarriageStats
mrcaseStat
:
vAreaMarriageStats
)
{
// 记录统计数
VAreaMarriageStats
ms
=
vAreaMarriageStatsDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
VAreaMarriageStats
.
builder
().
areaCode
(
mrcaseStat
.
getAreaCode
()).
createTime
(
DateUtil
.
parseDate
(
DateUtil
.
today
())).
build
()));
if
(
ms
==
null
)
{
vAreaMarriageStatsDao
.
insert
(
mrcaseStat
);
}
}
}
public
Object
cjTwoSubsidies
(
StatsReqVo
vo
)
{
if
(
StringUtils
.
isBlank
(
vo
.
getAreaCode
()))
{
vo
.
setAreaCode
(
"450000000000"
);
}
SystemArea
systemArea
=
areaDao
.
selectById
(
vo
.
getAreaCode
());
return
null
;
}
/**
* 获取冷静期和真正离婚的折线图数据
*
* @param vo
* @return
*/
public
Object
getDivorceCoolingLine
(
StatsReqVo
vo
)
{
// 获取冷静期
List
<
StatsVo
>
statsVoList
=
hyStatsDao
.
getMonthDivorceCoolingData
(
vo
);
return
null
;
}
}
portal-server/src/main/java/com/zq/portal/task/HyTask.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
portal
.
task
;
import
cn.hutool.core.date.DateUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.zq.common.entity.SystemArea
;
import
com.zq.portal.dao.AreaDao
;
import
com.zq.portal.service.HyStatsService
;
import
com.zq.portal.vo.StatsReqVo
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
java.util.Date
;
import
java.util.List
;
@Component
@RequiredArgsConstructor
public
class
HyTask
{
private
final
HyStatsService
hyStatsService
;
private
final
AreaDao
areaDao
;
/**
* 每天凌晨统计数据
*/
@Scheduled
(
cron
=
"0 0 0 * * ?"
)
@Scheduled
(
cron
=
"0 */30 * * * ?"
)
public
void
sync
()
{
System
.
out
.
println
(
"婚姻基本数统计 触发时间 :"
+
new
Date
());
hyStatsService
.
getMarryPerYear
(
StatsReqVo
.
builder
().
areaCode
(
"450000000000"
).
build
());
hyStatsService
.
getMarriageStats
(
StatsReqVo
.
builder
().
areaCode
(
"450000000000"
).
build
());
hyStatsService
.
getAreaUnderMarriageStatsList
(
StatsReqVo
.
builder
().
areaCode
(
"450000000000"
).
build
());
List
<
SystemArea
>
systemAreaList
=
areaDao
.
selectList
(
Wrappers
.
lambdaQuery
(
SystemArea
.
builder
().
parentId
(
"450000000000"
).
build
()));
for
(
SystemArea
systemArea
:
systemAreaList
)
{
hyStatsService
.
getAreaUnderMarriageStatsList
(
StatsReqVo
.
builder
().
areaCode
(
systemArea
.
getCode
()).
build
());
List
<
SystemArea
>
systemAreas
=
areaDao
.
selectList
(
Wrappers
.
lambdaQuery
(
SystemArea
.
builder
().
parentId
(
systemArea
.
getCode
()).
build
()));
for
(
SystemArea
area
:
systemAreas
)
{
hyStatsService
.
getAreaUnderMarriageStatsList
(
StatsReqVo
.
builder
().
areaCode
(
area
.
getCode
()).
build
());
}
}
}
}
portal-server/src/main/java/com/zq/portal/vo/LineDataVo.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
portal
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public
class
LineDataVo
{
public
List
<
String
>
dateList
;
public
List
<
String
>
amountList
;
}
portal-server/src/main/resources/application.yml
View file @
670439a5
...
...
@@ -85,6 +85,11 @@ spring:
test-on-return
:
false
# 检测连接是否有效
validation-query
:
select 1
filters
:
stat
stat
:
merge-sql
:
true
log-slow-sql
:
true
slow-sql-millis
:
2000
# mybatis plus 配置
mybatis-plus
:
...
...
portal-server/src/main/resources/mapper/HyStatsMapper.xml
View file @
670439a5
...
...
@@ -3,27 +3,29 @@
<mapper
namespace=
"com.zq.portal.dao.HyStatsDao"
>
<select
id=
"getMarryPerYear"
resultType=
"com.zq.portal.vo.StatsVo"
>
SELECT COUNT(1) 'num',
DATE_FORMAT(m.AIAX0048,"%Y"
) 'year'
SELECT COUNT(1) 'num',
m.AIAX0001 'type', DATE_FORMAT( m.AIAX0048, "%Y"
) 'year'
FROM mrcase m
WHERE (m.AIAP0013 LIKE CONCAT(#{areaCode}, '%') OR m.AIAP0014 LIKE CONCAT(#{areaCode}, '%'))
WHERE m.AIAX0072 = '1'
AND m.BIAX0075 = '1'
AND m.AIAX0001 = #{type}
GROUP BY DATE_FORMAT(m.AIAX0048, "%Y")
ORDER BY DATE_FORMAT(m.AIAX0048, "%Y") DESC LIMIT
3
ORDER BY DATE_FORMAT(m.AIAX0048, "%Y") DESC LIMIT
5
</select>
<select
id=
"get
TotalMarryDivorce
"
resultType=
"com.zq.portal.vo.StatsVo"
>
<select
id=
"get
MarriageStats
"
resultType=
"com.zq.portal.vo.StatsVo"
>
SELECT
COUNT( 1 ) 'num',
m.AIAX0001 'type'
FROM
mrcase m LEFT JOIN taorg t
ON m.AIAX0003 = t.ORGID
mrcase m LEFT JOIN taorg t ON m.AIAX0003 = t.ORGID
WHERE
m.AIAX0072 = '1'
AND m.BIAX0075 = '1'
<if
test=
"startTime != null and startTime != ''"
>
AND AIAX0048 >= #{startTime}
AND
m.
AIAX0048 >= #{startTime}
</if>
<if
test=
"endTime != null and endTime != ''"
>
AND AIAX0048
<
= #{endTime}
AND
m.
AIAX0048
<
= #{endTime}
</if>
<if
test=
"areaCode != null and areaCode != ''"
>
AND t.YAB003 LIKE CONCAT(#{areaCode},'%')
...
...
@@ -32,62 +34,99 @@
m.AIAX0001
</select>
<select
id=
"getMarryNum"
resultType=
"com.zq.portal.vo.StatsVo"
>
<!--获取跨地婚姻统计-->
<select
id=
"getCrossMarriageStats"
resultType=
"com.zq.portal.vo.StatsVo"
>
SELECT
COUNT(1) 'num', AIAX0001 'type'
COUNT( 1 ) 'num',
m.AIAX0001 'type'
FROM
mrcase
WHERE AIAX0001 = 'IA' AND AIAX0072 = 1
<if
test=
"year != null"
>
AND AIAX0048 >= #{year}
mrcase m LEFT JOIN taorg t ON m.AIAX0003 = t.ORGID
WHERE
m.AIAX0072 = '1'
AND m.BIAX0075 = '1'
AND LEFT(m.AIAP0013,4) != LEFT(t.YAB003,4)
AND LEFT(m.AIAP0014,4) != LEFT(t.YAB003,4)
<if
test=
"startTime != null and startTime != ''"
>
AND m.AIAX0048 >= #{startTime}
</if>
<if
test=
"endTime != null and endTime != ''"
>
AND m.AIAX0048
<
= #{endTime}
</if>
<if
test=
"areaCode != null and areaCode != ''"
>
AND
(AIAP0013 LIKE CONCAT(#{areaCode},'%') OR AIAP0014 LIKE CONCAT(#{areaCode},'%')
)
AND
t.YAB003 LIKE CONCAT(#{areaCode},'%'
)
</if>
GROUP BY
m.AIAX0001
</select>
<select
id=
"getDivorceNum"
resultType=
"com.zq.portal.vo.StatsVo"
>
SELECT
COUNT(1) 'num', AIAX0001 'type'
FROM
mrcase
WHERE AIAX0001 = 'IA' AND AIAX0072 = 1
<if
test=
"year != null"
>
AND AIAX0048 >= #{year}
<!--获取离婚中的人数-->
<select
id=
"getInDivorceNum"
resultType=
"com.zq.portal.vo.StatsVo"
>
SELECT COUNT(1) 'num', m.AIAX0001 'type'
FROM mrcase m LEFT JOIN taorg t ON m.AIAX0003 = t.ORGID
WHERE m.AIAX0001 = 'IB'
AND m.BIAX0075 = '1'
AND m.AIAX0072 != '1'
<if
test=
"startTime != null and startTime != ''"
>
AND m.AIAX0048 >= #{startTime}
</if>
<if
test=
"endTime != null and endTime != ''"
>
AND m.AIAX0048
<
= #{endTime}
</if>
<if
test=
"areaCode != null and areaCode != ''"
>
AND t.YAB003 LIKE CONCAT(#{areaCode},'%')
</if>
</select>
<!--获取结婚人数-->
<select
id=
"getMarryNum"
resultType=
"com.zq.portal.vo.StatsVo"
>
SELECT COUNT(1) 'num', m.AIAX0001 'type'
FROM mrcase m JOIN taorg t ON m.AIAX0003 = t.ORGID
WHERE m.AIAX0001 = 'IA'
AND m.BIAX0075 = '1'
AND m.AIAX0072 = '1'
<if
test=
"startTime != null and startTime != ''"
>
AND m.AIAX0048 >= #{startTime}
</if>
<if
test=
"endTime != null and endTime != ''"
>
AND m.AIAX0048
<
= #{endTime}
</if>
<if
test=
"areaCode != null and areaCode != ''"
>
AND
(AIAP0013 LIKE CONCAT(#{areaCode},'%') OR AIAP0014 LIKE CONCAT(#{areaCode},'%')
)
AND
t.YAB003 LIKE CONCAT(#{areaCode},'%'
)
</if>
</select>
<select
id=
"getMonthDivorceCoolingData"
resultType=
"com.zq.portal.vo.StatsVo"
>
SELECT
LEFT(m.AIAX0048,
10),
COUNT
(1) 'num'
LEFT (m.AIAX0048,
10),
COUNT
(1) 'num'
FROM
mrcheck m
LEFT JOIN mrcheckappend ma ON m.BIAX0069 = ma.BIAX0069
mrcheck m
LEFT JOIN mrcheckappend ma
ON m.BIAX0069 = ma.BIAX0069
WHERE
m.AIAX0001 = 'IB'
AND m.AIAX0072 = '1'
AND m.BIAX0015 = '6'
AND ma.COLEENDTIME
<
CURDATE()
GROUP BY LEFT(m.AIAX0048,10)
m.AIAX0001 = 'IB'
AND m.AIAX0072 = '1'
AND m.BIAX0015 = '6'
AND ma.COLEENDTIME
<
CURDATE()
GROUP BY LEFT (m.AIAX0048, 10)
</select>
<select
id=
"getMonthDivorceData"
resultType=
"com.zq.portal.vo.StatsVo"
>
SELECT
LEFT(m.AIAX0048,
10),
COUNT
(1) 'num'
LEFT (m.AIAX0048,
10),
COUNT
(1) 'num'
FROM
mrcheck m
LEFT JOIN mrcheckappend ma ON m.BIAX0069 = ma.BIAX0069
mrcheck m
LEFT JOIN mrcheckappend ma
ON m.BIAX0069 = ma.BIAX0069
WHERE
m.AIAX0001 = 'IB'
AND m.AIAX0072 = '1'
AND m.BIAX0015 = '6'
AND ma.COLEENDTIME > CURDATE()
GROUP BY LEFT(m.AIAX0048,10)
m.AIAX0001 = 'IB'
AND m.AIAX0072 = '1'
AND m.BIAX0015 = '6'
AND ma.COLEENDTIME
> CURDATE()
GROUP BY LEFT (m.AIAX0048, 10)
</select>
...
...
user-server/pom.xml
View file @
670439a5
...
...
@@ -65,6 +65,11 @@
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
${mybatis.plus.version}
</version>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
dynamic-datasource-spring-boot-starter
</artifactId>
<version>
3.4.0
</version>
</dependency>
<!-- druid数据源驱动 -->
<dependency>
<groupId>
com.alibaba
</groupId>
...
...
user-server/src/main/java/com/zq/user/Swagger.java
0 → 100644
View file @
670439a5
package
com
.
zq
.
user
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
import
springfox.documentation.service.ApiInfo
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spring.web.plugins.Docket
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
/**
* @author bici
*/
@Configuration
@EnableSwagger2
public
class
Swagger
{
@Value
(
"${spring.cloud.config.profile}"
)
private
String
profile
;
@Bean
public
Docket
api
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
groupName
(
"admin"
)
.
enable
(!
"product"
.
equals
(
profile
))
//生产环境关闭
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.zq.user.controller.admin"
))
.
paths
(
PathSelectors
.
any
())
.
build
()
.
apiInfo
(
apiInfo
());
}
private
ApiInfo
apiInfo
()
{
return
new
ApiInfoBuilder
()
.
title
(
"后台接口文档"
)
.
description
(
"查看接口文档"
)
.
build
();
}
@Bean
public
Docket
app
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
groupName
(
"App"
)
.
enable
(!
"product"
.
equals
(
profile
))
//生产环境关闭
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.zq.user.controller.app"
))
.
paths
(
PathSelectors
.
any
())
.
build
()
.
apiInfo
(
appInfo
());
}
private
ApiInfo
appInfo
()
{
return
new
ApiInfoBuilder
()
.
title
(
"APP接口文档"
)
.
description
(
"查看接口文档"
)
.
build
();
}
}
user-server/src/main/java/com/zq/user/controller/app/UserController.java
View file @
670439a5
...
...
@@ -47,4 +47,12 @@ public class UserController {
return
ResultVo
.
success
(
userService
.
phoneLogin
(
vo
));
}
@ApiOperation
(
"密码登录"
)
@PostMapping
(
value
=
"/passwdLogin"
)
public
ResultVo
<
ApiTokenVo
>
passwdLogin
(
@RequestBody
LoginVo
vo
)
{
AssertUtils
.
hasText
(
vo
.
getPhone
(),
"手机号不能为空"
);
AssertUtils
.
hasText
(
vo
.
getPasswd
(),
"请输入密码"
);
return
ResultVo
.
success
(
userService
.
passwdLogin
(
vo
));
}
}
user-server/src/main/java/com/zq/user/dao/PfuserDao.java
View file @
670439a5
package
com
.
zq
.
user
.
dao
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.zq.common.constant.DBName
;
import
com.zq.common.entity.Pfuser
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -10,6 +12,7 @@ import org.springframework.stereotype.Repository;
* @author makejava
* @since 2021-06-23 17:56:31
*/
@DS
(
DBName
.
GXSHZZ
)
@Repository
public
interface
PfuserDao
extends
BaseMapper
<
Pfuser
>
{
...
...
user-server/src/main/java/com/zq/user/service/UserService.java
View file @
670439a5
...
...
@@ -38,6 +38,7 @@ public class UserService {
*/
public
void
sendCode
(
String
phone
)
{
String
code
=
RandomUtil
.
randomNumbers
(
6
);
code
=
"111111"
;
log
.
info
(
">> phone: {}, sendCode: {}"
,
phone
,
code
);
String
content
=
"您的验证码为:"
+
code
+
"(5分钟内有效)。为了保障信息安全,如非本人操作请忽略本短信。"
;
// TencentSmsUtils.sendSms(phone, code);
...
...
@@ -53,7 +54,24 @@ public class UserService {
verificationCode
(
vo
.
getPhone
(),
vo
.
getVerifyCode
());
AppUser
appUser
=
userDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
AppUser
.
builder
().
phone
(
vo
.
getPhone
()).
build
()));
AssertUtils
.
notNull
(
appUser
,
"无此用户"
);
if
(
appUser
==
null
)
{
Pfuser
pfuser
=
pfuserDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
Pfuser
.
builder
().
phone
(
vo
.
getPhone
()).
state
(
0L
).
build
()));
if
(
pfuser
!=
null
)
{
appUser
=
AppUser
.
builder
()
.
name
(
pfuser
.
getUsername
())
.
age
(
pfuser
.
getSex
().
intValue
())
.
phone
(
pfuser
.
getPhone
())
.
password
(
DigestUtils
.
md5DigestAsHex
(
vo
.
getPasswd
().
getBytes
()))
.
userType
(
pfuser
.
getType
().
intValue
())
.
age
(
IdcardUtil
.
getAgeByIdCard
(
pfuser
.
getIdcardno
()))
.
status
(
pfuser
.
getState
().
intValue
())
.
build
();
userDao
.
insert
(
appUser
);
return
;
}
}
AssertUtils
.
notNull
(
appUser
,
"手机号不存在"
);
appUser
.
setPassword
(
DigestUtils
.
md5DigestAsHex
(
vo
.
getPasswd
().
getBytes
()));
...
...
@@ -70,17 +88,32 @@ public class UserService {
.
name
(
pfuser
.
getUsername
())
.
age
(
pfuser
.
getSex
().
intValue
())
.
phone
(
pfuser
.
getPhone
())
.
password
(
DigestUtils
.
md5DigestAsHex
(
"123456"
.
getBytes
()))
.
userType
(
pfuser
.
getType
().
intValue
())
.
age
(
IdcardUtil
.
getAgeByIdCard
(
pfuser
.
getIdcardno
()))
.
status
(
pfuser
.
getState
().
intValue
())
.
build
();
userDao
.
insert
(
appUser
);
}
}
AssertUtils
.
notNull
(
appUser
,
"用户不存在"
);
AssertUtils
.
isTrue
(
DigestUtils
.
md5DigestAsHex
(
vo
.
getPasswd
().
getBytes
()).
equals
(
appUser
.
getPassword
()),
"密码错误"
);
AssertUtils
.
notNull
(
appUser
,
"手机号不存在"
);
verificationCode
(
vo
.
getPhone
(),
vo
.
getVerifyCode
());
AssertUtils
.
isTrue
(
appUser
.
getStatus
()
==
0
,
appUser
.
getStatus
()
==
1
?
"账号已冻结"
:
"账号已删除"
);
AssertUtils
.
isTrue
(
appUser
.
getStatus
()
==
1
,
appUser
.
getStatus
()
==
2
?
"账号已暂停使用"
:
"账号已冻结"
);
appUser
.
setAccessIp
(
ServletUtil
.
getClientIP
(
HttpRequestUtils
.
getRequest
()));
appUser
.
setLastLoginTime
(
DateUtil
.
date
());
userDao
.
updateById
(
appUser
);
return
getApiToken
(
appUser
);
}
public
ApiTokenVo
passwdLogin
(
LoginVo
vo
)
{
AppUser
appUser
=
userDao
.
selectOne
(
Wrappers
.
lambdaQuery
(
AppUser
.
builder
().
phone
(
vo
.
getPhone
()).
build
()));
AssertUtils
.
notNull
(
appUser
,
"手机号不存在"
);
AssertUtils
.
isTrue
(
DigestUtils
.
md5DigestAsHex
(
vo
.
getPasswd
().
getBytes
()).
equals
(
appUser
.
getPassword
()),
"密码错误"
);
AssertUtils
.
isTrue
(
appUser
.
getStatus
()
==
0
,
appUser
.
getStatus
()
==
1
?
"账号已冻结"
:
"账号已删除"
);
appUser
.
setAccessIp
(
ServletUtil
.
getClientIP
(
HttpRequestUtils
.
getRequest
()));
appUser
.
setLastLoginTime
(
DateUtil
.
date
());
...
...
@@ -127,5 +160,4 @@ public class UserService {
return
tokenVo
;
}
}
user-server/src/main/resources/application.yml
View file @
670439a5
...
...
@@ -19,52 +19,52 @@ spring:
database
:
0
host
:
${redis.url}
port
:
${redis.port}
password
:
${redis.password}
#
password: ${redis.password}
#连接超时时间
timeout
:
5000
datasource
:
druid
:
db-type
:
com.alibaba.druid.pool.DruidDataSource
driverClassName
:
${jdbc.driver-class-name}
username
:
${jdbc.username}
password
:
${jdbc.password}
url
:
${jdbc.url}
# 初始连接数
initial-size
:
5
# 最小连接数
min-idle
:
10
# 最大连接数
max-active
:
20
# 获取连接超时时间
max-wait
:
5000
# 连接有效性检测时间
time-between-eviction-runs-millis
:
60000
# 连接在池中最小生存的时间
min-evictable-idle-time-millis
:
300000
# 连接在池中最大生存的时间
max-evictable-idle-time-millis
:
900000
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
# 检测连接是否有效
validation-query
:
select 1
# 配置监控统计
webStatFilter
:
enabled
:
true
stat-view-servlet
:
enabled
:
true
url-pattern
:
/druid/*
reset-enable
:
false
filter
:
dynamic
:
# mybatis plus多数据源插件
primary
:
master
#设置默认的数据源或者数据源组,默认值即为master
strict
:
false
#严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
datasource
:
master
:
type
:
com.alibaba.druid.pool.DruidDataSource
url
:
${jdbc.url}
username
:
${jdbc.username}
password
:
${jdbc.password}
driver-class-name
:
${jdbc.driver-class-name}
shzz
:
type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:mysql://192.168.0.193:3306/shzz?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
username
:
root
password
:
rooT123!321
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
# 初始连接数
initial-size
:
5
# 最小连接数
min-idle
:
10
# 最大连接数
max-active
:
20
# 获取连接超时时间
max-wait
:
5000
# 连接有效性检测时间
time-between-eviction-runs-millis
:
60000
# 连接在池中最小生存的时间
min-evictable-idle-time-millis
:
300000
# 连接在池中最大生存的时间
max-evictable-idle-time-millis
:
900000
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
# 检测连接是否有效
validation-query
:
select 1
filters
:
stat
stat
:
enabled
:
true
# 记录慢SQL
log-slow-sql
:
true
slow-sql-millis
:
1000
merge-sql
:
true
wall
:
config
:
multi-statement-allow
:
true
log-slow-sql
:
true
slow-sql-millis
:
2000
# mybatis plus 配置
mybatis-plus
:
global-config
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment