Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
b955e5d3
Commit
b955e5d3
authored
Jul 02, 2024
by
hezhuozhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
27303 一个农户只能注册一个账号,无法满足农户有多个房子时,需签订多个不同合同的需求
parent
c8f77d3d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
293 additions
and
176 deletions
+293
-176
PeasantHouseholdPageDto.java
...mos/boot/module/hygf/api/dto/PeasantHouseholdPageDto.java
+10
-0
PeasantHouseholdWxController.java
...ule/hygf/biz/controller/PeasantHouseholdWxController.java
+92
-33
PeasantHouseholdServiceImpl.java
...le/hygf/biz/service/impl/PeasantHouseholdServiceImpl.java
+191
-143
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/PeasantHouseholdPageDto.java
0 → 100644
View file @
b955e5d3
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
dto
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
lombok.Data
;
@Data
public
class
PeasantHouseholdPageDto
extends
Page
<
PeasantHouseholdPageDto
>
{
private
String
nhUserId
;
private
String
peasantHouseholdNo
;
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/PeasantHouseholdWxController.java
View file @
b955e5d3
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
controller
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
controller
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.MobileLoginParamDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.MobileLoginParamDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdPageDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdWxDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.PeasantHouseholdWxDto
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IWxService
;
import
com.yeejoin.amos.boot.module.hygf.api.service.IWxService
;
...
@@ -24,7 +28,6 @@ import io.swagger.annotations.ApiOperation;
...
@@ -24,7 +28,6 @@ import io.swagger.annotations.ApiOperation;
import
io.swagger.annotations.ApiParam
;
import
io.swagger.annotations.ApiParam
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -45,37 +48,29 @@ import java.util.*;
...
@@ -45,37 +48,29 @@ import java.util.*;
* @date 2023-07-07
* @date 2023-07-07
*/
*/
@RestController
@RestController
@Api
(
tags
=
"农户信息Api for mobile端"
)
@Api
(
tags
=
"农户信息Api for mobile端"
)
@RequestMapping
(
value
=
"/peasant-household/mobile"
)
@RequestMapping
(
value
=
"/peasant-household/mobile"
)
@Slf4j
@Slf4j
public
class
PeasantHouseholdWxController
extends
BaseController
{
public
class
PeasantHouseholdWxController
extends
BaseController
{
private
static
final
String
regionRedis
=
"app_region_redis"
;
@Autowired
@Autowired
RedisUtils
redisUtil
;
RedisUtils
redisUtil
;
@Autowired
@Autowired
SurveyInformationServiceImpl
surveyInformationServiceImpl
;
SurveyInformationServiceImpl
surveyInformationServiceImpl
;
@Autowired
@Autowired
PeasantHouseholdServiceImpl
peasantHouseholdServiceImpl
;
PeasantHouseholdServiceImpl
peasantHouseholdServiceImpl
;
@Autowired
@Autowired
HouseholdContractServiceImpl
householdContractServiceImpl
;
HouseholdContractServiceImpl
householdContractServiceImpl
;
@Autowired
@Autowired
private
IWxService
wxService
;
private
IWxService
wxService
;
@Value
(
"${dealer.userId}"
)
@Value
(
"${dealer.userId}"
)
private
String
defaultUserId
;
private
String
defaultUserId
;
@Value
(
"${hygfProgram.loginPage:view/mine/minepage/LoginPhone}"
)
@Value
(
"${hygfProgram.loginPage:view/mine/minepage/LoginPhone}"
)
private
String
miniprogramLoginPage
;
private
String
miniprogramLoginPage
;
@Autowired
@Autowired
private
AmosRequestContext
requestContext
;
private
AmosRequestContext
requestContext
;
private
static
final
String
regionRedis
=
"app_region_redis"
;
/*@TycloudOperation (ApiLevel = UserType.AGENCY, needAuth = false)
/*@TycloudOperation (ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping (value = "/authenticate", method = RequestMethod.POST)
@RequestMapping (value = "/authenticate", method = RequestMethod.POST)
@ApiOperation (httpMethod = "POST", value = "微信农户认证", notes = "微信农户认证")
@ApiOperation (httpMethod = "POST", value = "微信农户认证", notes = "微信农户认证")
...
@@ -83,7 +78,7 @@ public class PeasantHouseholdWxController extends BaseController {
...
@@ -83,7 +78,7 @@ public class PeasantHouseholdWxController extends BaseController {
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.doAuthenticate(sequenceNbr));
return ResponseHelper.buildResponse(peasantHouseholdServiceImpl.doAuthenticate(sequenceNbr));
}*/
}*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
"获取验证码"
)
@ApiOperation
(
"获取验证码"
)
@GetMapping
(
"/getAuthCode"
)
@GetMapping
(
"/getAuthCode"
)
public
ResponseModel
<
Boolean
>
getAuthCode
(
@RequestParam
String
phoneNo
)
{
public
ResponseModel
<
Boolean
>
getAuthCode
(
@RequestParam
String
phoneNo
)
{
...
@@ -100,9 +95,9 @@ public class PeasantHouseholdWxController extends BaseController {
...
@@ -100,9 +95,9 @@ public class PeasantHouseholdWxController extends BaseController {
return
ResponseHelper
.
buildResponse
(
true
);
return
ResponseHelper
.
buildResponse
(
true
);
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"微信授权登陆"
,
notes
=
"微信授权登陆"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"微信授权登陆"
,
notes
=
"微信授权登陆"
)
public
ResponseModel
<
PeasantHouseholdWxDto
>
wxUserLogin
(
@ApiParam
@RequestBody
MobileLoginParamDto
mobileLoginParam
)
{
public
ResponseModel
<
PeasantHouseholdWxDto
>
wxUserLogin
(
@ApiParam
@RequestBody
MobileLoginParamDto
mobileLoginParam
)
{
log
.
info
(
"微信授权登录入参 => {}"
,
mobileLoginParam
);
log
.
info
(
"微信授权登录入参 => {}"
,
mobileLoginParam
);
if
(
StringUtils
.
isBlank
(
mobileLoginParam
.
getAmosUserId
()))
{
if
(
StringUtils
.
isBlank
(
mobileLoginParam
.
getAmosUserId
()))
{
...
@@ -113,11 +108,10 @@ public class PeasantHouseholdWxController extends BaseController {
...
@@ -113,11 +108,10 @@ public class PeasantHouseholdWxController extends BaseController {
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/getRegisterPhone"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/getRegisterPhone"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"获取手机号及回填信息"
,
notes
=
"获取手机号及回填信息"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"获取手机号及回填信息"
,
notes
=
"获取手机号及回填信息"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getRegisterPhone
(
@ApiParam
@RequestBody
MobileLoginParamDto
mobileLoginParam
)
{
public
ResponseModel
<
Map
<
String
,
Object
>>
getRegisterPhone
(
@ApiParam
@RequestBody
MobileLoginParamDto
mobileLoginParam
)
{
log
.
info
(
"微信授权注册入参 => {}"
,
mobileLoginParam
);
log
.
info
(
"微信授权注册入参 => {}"
,
mobileLoginParam
);
if
(
StringUtils
.
isBlank
(
mobileLoginParam
.
getAmosUserId
()))
{
if
(
StringUtils
.
isBlank
(
mobileLoginParam
.
getAmosUserId
()))
{
// 扫码的userId为空, 则取默认值
// 扫码的userId为空, 则取默认值
...
@@ -126,19 +120,84 @@ public class PeasantHouseholdWxController extends BaseController {
...
@@ -126,19 +120,84 @@ public class PeasantHouseholdWxController extends BaseController {
return
ResponseHelper
.
buildResponse
(
peasantHouseholdServiceImpl
.
getRegisterPhone
(
mobileLoginParam
));
return
ResponseHelper
.
buildResponse
(
peasantHouseholdServiceImpl
.
getRegisterPhone
(
mobileLoginParam
));
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/register"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/getJxsAndNhData"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"微信农户注册"
,
notes
=
"微信农户注册"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取经销商农户信息"
,
notes
=
"获取经销商农户信息"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getJxsAndNhData
(
@ApiParam
(
value
=
"农户Id"
)
@RequestParam
(
value
=
"nhUserId"
)
String
nhUserId
,
@ApiParam
(
value
=
"经销商Id"
)
@RequestParam
(
value
=
"jxsUserId"
)
String
jxsUserId
,
@ApiParam
(
value
=
"二维码类型"
)
@RequestParam
(
value
=
"qrCodeType"
)
String
qrCodeType
)
{
return
ResponseHelper
.
buildResponse
(
peasantHouseholdServiceImpl
.
getJxsAndNhData
(
nhUserId
,
jxsUserId
,
qrCodeType
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/getPeasantHouseByUserId"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"分页获取农户"
,
notes
=
"分页获取农户信息"
)
public
ResponseModel
<
IPage
<
PeasantHousehold
>>
getPeasantHouseByUserId
(
@RequestBody
PeasantHouseholdPageDto
peasantHouseholdPageDto
)
{
return
ResponseHelper
.
buildResponse
(
peasantHouseholdServiceImpl
.
getPeasantHousePage
(
peasantHouseholdPageDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/addPeasantHousehold"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增农户"
,
notes
=
"新增农户"
)
public
ResponseModel
<
String
>
addPeasantHousehold
(
@ApiParam
@RequestBody
PeasantHouseholdDto
peasantHouseholdDto
)
{
//此处是新增农户,根据用户id查询必须要有一个农户,否则直接抛错
List
<
PeasantHousehold
>
peasantHouseList
=
peasantHouseholdServiceImpl
.
getPeasantHouseByUserId
(
peasantHouseholdDto
.
getAmosUserId
());
if
(
CollectionUtil
.
isEmpty
(
peasantHouseList
))
{
throw
new
BadRequest
(
"没有查询到注册的农户,请注册后在进行新增"
);
}
validatedPeasantHouseholdDto
(
peasantHouseholdDto
);
peasantHouseholdDto
.
setPeasantHouseholdNo
(
peasantHouseholdServiceImpl
.
getPeasantHouseholdNo
(
peasantHouseholdDto
.
getRegionalCompaniesSeq
()));
peasantHouseholdDto
.
setIsCertified
(
1
);
// 这里就实名认证
peasantHouseholdDto
.
setSurveyOrNot
(
0
);
peasantHouseholdDto
.
setReview
(
0
);
JSONArray
regionName
=
getRegionName
();
List
<
RegionModel
>
list
=
JSONArray
.
parseArray
(
regionName
.
toJSONString
(),
RegionModel
.
class
);
// 处理项目地址
String
area
=
""
;
if
(
peasantHouseholdDto
.
getProjectAddress
()
!=
null
&&
peasantHouseholdDto
.
getProjectAddress
().
size
()
!=
0
)
{
for
(
Integer
reg
:
peasantHouseholdDto
.
getProjectAddress
())
for
(
RegionModel
re
:
list
)
{
if
(
re
.
getRegionCode
().
equals
(
Integer
.
valueOf
(
reg
)))
{
area
=
area
+
re
.
getRegionName
()
+
"/"
;
}
}
peasantHouseholdDto
.
setProjectAddressName
(
area
.
length
()
>
2
?
area
.
substring
(
0
,
area
.
length
()
-
1
)
:
area
);
if
(
"1"
.
equals
(
peasantHouseholdDto
.
getIsPermanent
())
||
"true"
.
equals
(
peasantHouseholdDto
.
getIsPermanent
()))
{
peasantHouseholdDto
.
setPermanentAddress
(
peasantHouseholdDto
.
getProjectAddress
());
peasantHouseholdDto
.
setPermanentAddressDetail
(
peasantHouseholdDto
.
getProjectAddressDetail
());
peasantHouseholdDto
.
setPermanentAddressName
(
area
.
length
()
>
2
?
area
.
substring
(
0
,
area
.
length
()
-
1
)
:
area
);
}
else
{
// 处理常住地址
String
permanent
=
""
;
if
(
peasantHouseholdDto
.
getPermanentAddress
()
!=
null
&&
peasantHouseholdDto
.
getPermanentAddress
().
size
()
!=
0
)
{
for
(
Integer
reg
:
peasantHouseholdDto
.
getPermanentAddress
())
for
(
RegionModel
re
:
list
)
{
if
(
re
.
getRegionCode
().
equals
(
Integer
.
valueOf
(
reg
)))
{
permanent
=
permanent
+
re
.
getRegionName
()
+
"/"
;
}
}
peasantHouseholdDto
.
setPermanentAddressName
(
permanent
.
length
()
>
2
?
permanent
.
substring
(
0
,
permanent
.
length
()
-
1
)
:
permanent
);
}
}
}
PeasantHouseholdDto
result
=
peasantHouseholdServiceImpl
.
addNewPeasantHousehold
(
peasantHouseholdDto
);
return
ResponseHelper
.
buildResponse
(
"success"
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@RequestMapping
(
value
=
"/register"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"微信农户注册"
,
notes
=
"微信农户注册"
)
public
ResponseModel
<
PeasantHouseholdWxDto
>
wxUserRegister
(
@ApiParam
@RequestBody
MobileLoginParamDto
mobileLoginParam
)
{
public
ResponseModel
<
PeasantHouseholdWxDto
>
wxUserRegister
(
@ApiParam
@RequestBody
MobileLoginParamDto
mobileLoginParam
)
{
PeasantHousehold
peasantHousehold
=
new
PeasantHousehold
();
PeasantHousehold
peasantHousehold
=
new
PeasantHousehold
();
try
{
try
{
//注册并登录 生成农户信息表数据
//注册并登录 生成农户信息表数据
PeasantHouseholdWxDto
peasantHouseholdWxDto
=
peasantHouseholdServiceImpl
.
registerAndLogin
(
mobileLoginParam
);
PeasantHouseholdWxDto
peasantHouseholdWxDto
=
peasantHouseholdServiceImpl
.
registerAndLogin
(
mobileLoginParam
);
peasantHousehold
=
peasantHouseholdWxDto
.
getPeasantHousehold
();
peasantHousehold
=
peasantHouseholdWxDto
.
getPeasantHousehold
();
log
.
info
(
"微信农户注册, 入参 => {}"
,
mobileLoginParam
);
log
.
info
(
"微信农户注册, 入参 => {}"
,
mobileLoginParam
);
PeasantHouseholdDto
model
=
mobileLoginParam
.
getPeasantHouseholdDto
();
PeasantHouseholdDto
model
=
mobileLoginParam
.
getPeasantHouseholdDto
();
validatedPeasantHouseholdDto
(
model
);
validatedPeasantHouseholdDto
(
model
);
BeanDtoUtils
.
copyPropertiesAllNonNull
(
peasantHousehold
,
model
);
BeanDtoUtils
.
copyPropertiesAllNonNull
(
peasantHousehold
,
model
);
model
.
setPeasantHouseholdNo
(
peasantHouseholdServiceImpl
.
getPeasantHouseholdNo
(
model
.
getRegionalCompaniesSeq
()));
model
.
setPeasantHouseholdNo
(
peasantHouseholdServiceImpl
.
getPeasantHouseholdNo
(
model
.
getRegionalCompaniesSeq
()));
model
.
setIsCertified
(
1
);
// 这里就实名认证
model
.
setIsCertified
(
1
);
// 这里就实名认证
model
.
setSurveyOrNot
(
0
);
model
.
setSurveyOrNot
(
0
);
...
@@ -173,11 +232,11 @@ public class PeasantHouseholdWxController extends BaseController {
...
@@ -173,11 +232,11 @@ public class PeasantHouseholdWxController extends BaseController {
}
}
}
}
}
}
BeanDtoUtils
.
copyPropertiesAllNonNull
(
model
,
peasantHousehold
);
BeanDtoUtils
.
copyPropertiesAllNonNull
(
model
,
peasantHousehold
);
PeasantHouseholdDto
result
=
peasantHouseholdServiceImpl
.
savePeasantHousehold
(
model
,
null
);
PeasantHouseholdDto
result
=
peasantHouseholdServiceImpl
.
savePeasantHousehold
(
model
,
null
);
peasantHouseholdWxDto
.
setPeasantHousehold
(
peasantHousehold
);
peasantHouseholdWxDto
.
setPeasantHousehold
(
peasantHousehold
);
return
ResponseHelper
.
buildResponse
(
peasantHouseholdWxDto
);
return
ResponseHelper
.
buildResponse
(
peasantHouseholdWxDto
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
());
log
.
error
(
e
.
getMessage
());
if
(
null
!=
peasantHousehold
)
{
if
(
null
!=
peasantHousehold
)
{
log
.
error
(
"调用平台接口回滚注册的用户 => {}"
,
e
,
peasantHousehold
.
getAmosUserId
());
log
.
error
(
"调用平台接口回滚注册的用户 => {}"
,
e
,
peasantHousehold
.
getAmosUserId
());
...
@@ -227,12 +286,12 @@ public class PeasantHouseholdWxController extends BaseController {
...
@@ -227,12 +286,12 @@ public class PeasantHouseholdWxController extends BaseController {
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
"/getRegionQrCode"
)
@GetMapping
(
"/getRegionQrCode"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
" 获取区域经销商二维码"
,
notes
=
" 获取区域经销商二维码"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
" 获取区域经销商二维码"
,
notes
=
" 获取区域经销商二维码"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getRegionQrCode
(
public
ResponseModel
<
Map
<
String
,
Object
>>
getRegionQrCode
(
@RequestParam
(
value
=
"fileType"
,
required
=
false
,
defaultValue
=
"png"
)
String
fileType
,
@RequestParam
(
value
=
"fileType"
,
required
=
false
,
defaultValue
=
"png"
)
String
fileType
,
@RequestParam
(
value
=
"width"
,
required
=
false
,
defaultValue
=
"350"
)
String
width
,
@RequestParam
(
value
=
"width"
,
required
=
false
,
defaultValue
=
"350"
)
String
width
,
HttpServletResponse
response
)
{
HttpServletResponse
response
)
{
AgencyUserModel
userInfo
=
getUserInfo
();
AgencyUserModel
userInfo
=
getUserInfo
();
log
.
info
(
"获取区域经销商二维码, userId:{}"
,
userInfo
.
getUserId
());
log
.
info
(
"获取区域经销商二维码, userId:{}"
,
userInfo
.
getUserId
());
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/PeasantHouseholdServiceImpl.java
View file @
b955e5d3
...
@@ -2,20 +2,18 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
...
@@ -2,20 +2,18 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.ArrivalStateeEnum
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.ArrivalStateeEnum
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.CodeEnum
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.CodeEnum
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.PhoneRegisterTypeEum
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.PhoneRegisterTypeEum
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.TaskTypeStationEnum
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.TaskTypeStationEnum
;
import
com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.*
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.*
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.*
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.*
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.PeasantHouseholdMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.PeasantHouseholdMapper
;
...
@@ -57,86 +55,64 @@ import java.util.stream.Collectors;
...
@@ -57,86 +55,64 @@ import java.util.stream.Collectors;
*/
*/
@Service
@Service
@Slf4j
@Slf4j
public
class
PeasantHouseholdServiceImpl
extends
BaseService
<
PeasantHouseholdDto
,
PeasantHousehold
,
PeasantHouseholdMapper
>
implements
IPeasantHouseholdService
{
public
class
PeasantHouseholdServiceImpl
extends
BaseService
<
PeasantHouseholdDto
,
PeasantHousehold
,
PeasantHouseholdMapper
>
implements
IPeasantHouseholdService
{
public
static
final
String
SECRETKEY
=
"qaz"
;
@Autowired
SurveyInformationServiceImpl
surveyInformationService
;
@Autowired
SurveyDetailsServiceImpl
surveyDetailsService
;
@Autowired
InformationServiceImpl
informationService
;
@Autowired
ExtendedInformationServiceImpl
extendedInformationService
;
@Autowired
CommercialServiceImpl
commercialService
;
@Autowired
PeasantHouseholdMapper
peasantHouseholdMapper
;
@Autowired
SurveyInformationServiceImpl
surveyInformationServiceImpl
;
@Autowired
HouseholdContractServiceImpl
householdContractServiceImpl
;
@Autowired
PersonnelBusinessMapper
personnelBusinessMapper
;
@Autowired
UnitInfoServiceImpl
unitInfoServiceImpl
;
@Autowired
AmosRequestContext
requestContext
;
@Autowired
ToDoTasksServiceImpl
toDoTasksServiceImpl
;
@Autowired
RegionalCompaniesMapper
regionalCompaniesMapper
;
private
Long
TOKEN_TIME
=
1209600
l
;
private
Long
TOKEN_TIME
=
1209600
l
;
@Value
(
"${amos.system.user.product}"
)
@Value
(
"${amos.system.user.product}"
)
private
String
product
;
private
String
product
;
@Value
(
"${amos.system.user.app-key}"
)
@Value
(
"${amos.system.user.app-key}"
)
private
String
appKey
;
private
String
appKey
;
@Value
(
"${login.environment}"
)
@Value
(
"${login.environment}"
)
private
String
loginEnvironment
;
private
String
loginEnvironment
;
@Value
(
"${farmer.orgCode}"
)
@Value
(
"${farmer.orgCode}"
)
private
String
orgCode
;
private
String
orgCode
;
@Value
(
"${farmer.sequenceNbr}"
)
@Value
(
"${farmer.sequenceNbr}"
)
private
Long
orgSequenceNbr
;
private
Long
orgSequenceNbr
;
@Value
(
"${farmer.orgNamesWithoutRole:智信能源科技有限公司}"
)
@Value
(
"${farmer.orgNamesWithoutRole:智信能源科技有限公司}"
)
private
String
orgNamesWithoutRole
;
private
String
orgNamesWithoutRole
;
@Value
(
"${dealer.appcode}"
)
@Value
(
"${dealer.appcode}"
)
private
String
appCodes
;
private
String
appCodes
;
@Value
(
"${platform.access.loginId}"
)
@Value
(
"${platform.access.loginId}"
)
private
String
platfromAccessLoginId
;
private
String
platfromAccessLoginId
;
@Value
(
"${platform.access.password}"
)
@Value
(
"${platform.access.password}"
)
private
String
platfromAccessPassword
;
private
String
platfromAccessPassword
;
@Value
(
"${farmer.roleId:1678211468450885633}"
)
@Value
(
"${farmer.roleId:1678211468450885633}"
)
private
String
farmerRoleId
;
private
String
farmerRoleId
;
@Value
(
"${farmer.registerPassword}"
)
@Value
(
"${farmer.registerPassword}"
)
private
String
registerPassword
;
private
String
registerPassword
;
@Autowired
@Autowired
private
RedisUtils
redisUtils
;
private
RedisUtils
redisUtils
;
@Autowired
@Autowired
private
IWxService
wxService
;
private
IWxService
wxService
;
@Autowired
@Transactional
(
rollbackFor
=
Exception
.
class
)
SurveyInformationServiceImpl
surveyInformationService
;
@Autowired
SurveyDetailsServiceImpl
surveyDetailsService
;
@Autowired
InformationServiceImpl
informationService
;
@Autowired
ExtendedInformationServiceImpl
extendedInformationService
;
@Autowired
CommercialServiceImpl
commercialService
;
@Autowired
PeasantHouseholdMapper
peasantHouseholdMapper
;
@Autowired
SurveyInformationServiceImpl
surveyInformationServiceImpl
;
@Autowired
HouseholdContractServiceImpl
householdContractServiceImpl
;
@Autowired
PersonnelBusinessMapper
personnelBusinessMapper
;
@Autowired
UnitInfoServiceImpl
unitInfoServiceImpl
;
@Autowired
AmosRequestContext
requestContext
;
@Autowired
ToDoTasksServiceImpl
toDoTasksServiceImpl
;
@Autowired
RegionalCompaniesMapper
regionalCompaniesMapper
;
public
static
final
String
SECRETKEY
=
"qaz"
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
PeasantHouseholdDto
savePeasantHousehold
(
PeasantHouseholdDto
model
,
AgencyUserModel
userInfo
)
{
public
PeasantHouseholdDto
savePeasantHousehold
(
PeasantHouseholdDto
model
,
AgencyUserModel
userInfo
)
{
SurveyInformationDto
surveyInformationDto
=
new
SurveyInformationDto
();
SurveyInformationDto
surveyInformationDto
=
new
SurveyInformationDto
();
surveyInformationDto
.
setSurveyNumber
(
this
.
getkcNo
(
model
.
getRegionalCompaniesSeq
()));
surveyInformationDto
.
setSurveyNumber
(
this
.
getkcNo
(
model
.
getRegionalCompaniesSeq
()));
...
@@ -164,7 +140,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -164,7 +140,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
peasantHousehold
.
setConstructionState
(
ArrivalStateeEnum
.
待勘察
.
getCode
());
peasantHousehold
.
setConstructionState
(
ArrivalStateeEnum
.
待勘察
.
getCode
());
this
.
saveOrUpdate
(
peasantHousehold
);
this
.
saveOrUpdate
(
peasantHousehold
);
//生成合同
//生成合同
HouseholdContract
householdContract
=
new
HouseholdContract
();
HouseholdContract
householdContract
=
new
HouseholdContract
();
householdContract
.
setPartyA
(
peasantHousehold
.
getOwnersName
());
householdContract
.
setPartyA
(
peasantHousehold
.
getOwnersName
());
householdContract
.
setPeasantHouseholdNumber
(
peasantHousehold
.
getPeasantHouseholdNo
());
householdContract
.
setPeasantHouseholdNumber
(
peasantHousehold
.
getPeasantHouseholdNo
());
householdContract
.
setPeasantHouseholdCard
(
peasantHousehold
.
getIdCard
());
householdContract
.
setPeasantHouseholdCard
(
peasantHousehold
.
getIdCard
());
...
@@ -184,49 +160,49 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -184,49 +160,49 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
householdContractServiceImpl
.
addHouseholdContract
(
householdContract
);
householdContractServiceImpl
.
addHouseholdContract
(
householdContract
);
//生成待办任务
//生成待办任务
ToDoTasks
toDoTasks
=
new
ToDoTasks
(
TaskTypeStationEnum
.
电站勘察
.
getCode
(),
peasantHousehold
.
getSequenceNbr
(),
"用户"
+
householdContract
.
getPartyA
()+
"电站信息勘察"
,
householdContract
.
getDealerCode
());
ToDoTasks
toDoTasks
=
new
ToDoTasks
(
TaskTypeStationEnum
.
电站勘察
.
getCode
(),
peasantHousehold
.
getSequenceNbr
(),
"用户"
+
householdContract
.
getPartyA
()
+
"电站信息勘察"
,
householdContract
.
getDealerCode
());
toDoTasksServiceImpl
.
addToDoTasksByUserId
(
peasantHousehold
.
getDeveloperUserId
(),
toDoTasks
,
""
);
toDoTasksServiceImpl
.
addToDoTasksByUserId
(
peasantHousehold
.
getDeveloperUserId
(),
toDoTasks
,
""
);
ToDoTasks
toDoTasks1
=
new
ToDoTasks
(
TaskTypeStationEnum
.
合同填报
.
getCode
(),
householdContract
.
getSequenceNbr
(),
"用户"
+
householdContract
.
getPartyA
()+
"的合同待发起"
,
householdContract
.
getDealerCode
());
ToDoTasks
toDoTasks1
=
new
ToDoTasks
(
TaskTypeStationEnum
.
合同填报
.
getCode
(),
householdContract
.
getSequenceNbr
(),
"用户"
+
householdContract
.
getPartyA
()
+
"的合同待发起"
,
householdContract
.
getDealerCode
());
toDoTasksServiceImpl
.
addToDoTasksByUserId
(
peasantHousehold
.
getDeveloperUserId
(),
toDoTasks1
,
""
);
toDoTasksServiceImpl
.
addToDoTasksByUserId
(
peasantHousehold
.
getDeveloperUserId
(),
toDoTasks1
,
""
);
return
model
;
return
model
;
}
}
public
boolean
deletePeasantHouseholdBySequenceNbr
(
Long
sequenceNbr
){
public
boolean
deletePeasantHouseholdBySequenceNbr
(
Long
sequenceNbr
)
{
PeasantHouseholdDto
peasantHouseholdDto
=
this
.
queryBySeq
(
sequenceNbr
);
PeasantHouseholdDto
peasantHouseholdDto
=
this
.
queryBySeq
(
sequenceNbr
);
Long
surveyInformationId
=
peasantHouseholdDto
.
getSurveyInformationId
();
Long
surveyInformationId
=
peasantHouseholdDto
.
getSurveyInformationId
();
//删除勘察基本信息
//删除勘察基本信息
surveyInformationService
.
deleteBySeq
(
surveyInformationId
);
surveyInformationService
.
deleteBySeq
(
surveyInformationId
);
//删除扩展信息
//删除扩展信息
QueryWrapper
<
ExtendedInformation
>
extendedInformationDeleteWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
ExtendedInformation
>
extendedInformationDeleteWrapper
=
new
QueryWrapper
<>();
extendedInformationDeleteWrapper
.
lambda
().
eq
(
ExtendedInformation:
:
getSurveyInformationId
,
surveyInformationId
);
extendedInformationDeleteWrapper
.
lambda
().
eq
(
ExtendedInformation:
:
getSurveyInformationId
,
surveyInformationId
);
extendedInformationService
.
getBaseMapper
().
delete
(
extendedInformationDeleteWrapper
);
extendedInformationService
.
getBaseMapper
().
delete
(
extendedInformationDeleteWrapper
);
//删除勘察明细
//删除勘察明细
QueryWrapper
<
SurveyDetails
>
surveyDetailsDeleteWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
SurveyDetails
>
surveyDetailsDeleteWrapper
=
new
QueryWrapper
<>();
surveyDetailsDeleteWrapper
.
lambda
().
eq
(
SurveyDetails:
:
getSurveyInformationId
,
surveyInformationId
);
surveyDetailsDeleteWrapper
.
lambda
().
eq
(
SurveyDetails:
:
getSurveyInformationId
,
surveyInformationId
);
surveyDetailsService
.
getBaseMapper
().
delete
(
surveyDetailsDeleteWrapper
);
surveyDetailsService
.
getBaseMapper
().
delete
(
surveyDetailsDeleteWrapper
);
//删除商务信息
//删除商务信息
QueryWrapper
<
Commercial
>
commercialDeleteWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
Commercial
>
commercialDeleteWrapper
=
new
QueryWrapper
<>();
commercialDeleteWrapper
.
lambda
().
eq
(
Commercial:
:
getSurveyInformationId
,
surveyInformationId
);
commercialDeleteWrapper
.
lambda
().
eq
(
Commercial:
:
getSurveyInformationId
,
surveyInformationId
);
commercialService
.
getBaseMapper
().
delete
(
commercialDeleteWrapper
);
commercialService
.
getBaseMapper
().
delete
(
commercialDeleteWrapper
);
//删除资料归档信息
//删除资料归档信息
QueryWrapper
<
Information
>
informationDeleteWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
Information
>
informationDeleteWrapper
=
new
QueryWrapper
<>();
informationDeleteWrapper
.
lambda
().
eq
(
Information:
:
getSurveyInformationId
,
surveyInformationId
);
informationDeleteWrapper
.
lambda
().
eq
(
Information:
:
getSurveyInformationId
,
surveyInformationId
);
informationService
.
getBaseMapper
().
delete
(
informationDeleteWrapper
);
informationService
.
getBaseMapper
().
delete
(
informationDeleteWrapper
);
//删除农户信息
//删除农户信息
return
this
.
deleteBySeq
(
sequenceNbr
);
return
this
.
deleteBySeq
(
sequenceNbr
);
}
}
public
String
getkcNo
(
Long
sequenceNbr
)
{
public
String
getkcNo
(
Long
sequenceNbr
)
{
RegionalCompanies
da
=
regionalCompaniesMapper
.
selectRegionName
(
sequenceNbr
);
RegionalCompanies
da
=
regionalCompaniesMapper
.
selectRegionName
(
sequenceNbr
);
if
(
da
.
getCompanyCode
()==
null
||
da
.
getCompanyCode
().
isEmpty
())
{
if
(
da
.
getCompanyCode
()
==
null
||
da
.
getCompanyCode
().
isEmpty
())
{
throw
new
BadRequest
(
"区域公司编号为空, 请设置编号"
);
throw
new
BadRequest
(
"区域公司编号为空, 请设置编号"
);
}
}
if
(
da
.
getRegionalAddress
()==
null
||
da
.
getRegionalAddress
().
isEmpty
())
{
if
(
da
.
getRegionalAddress
()
==
null
||
da
.
getRegionalAddress
().
isEmpty
())
{
throw
new
BadRequest
(
"区域公司省市区为空, 请设置省市区"
);
throw
new
BadRequest
(
"区域公司省市区为空, 请设置省市区"
);
}
}
String
code
=
NumberUtil
.
getCode
(
CodeEnum
.
勘察
.
getCode
(),
da
.
getCompanyCode
(),
da
.
getRegionalAddress
());
String
code
=
NumberUtil
.
getCode
(
CodeEnum
.
勘察
.
getCode
(),
da
.
getCompanyCode
(),
da
.
getRegionalAddress
());
return
code
;
return
code
;
}
}
...
@@ -234,12 +210,12 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -234,12 +210,12 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
* 分页查询
* 分页查询
*/
*/
public
Page
<
PeasantHousehold
>
queryForPeasantHouseholdPage
(
Page
<
PeasantHousehold
>
page
,
String
developerCode
,
String
ownersName
,
Long
developerId
,
Integer
isCertified
)
{
public
Page
<
PeasantHousehold
>
queryForPeasantHouseholdPage
(
Page
<
PeasantHousehold
>
page
,
String
developerCode
,
String
ownersName
,
Long
developerId
,
Integer
isCertified
)
{
int
current
=
(
int
)
page
.
getCurrent
();
int
current
=
(
int
)
page
.
getCurrent
();
int
size
=
(
int
)
page
.
getSize
();
int
size
=
(
int
)
page
.
getSize
();
PageHelper
.
startPage
(
current
,
size
);
PageHelper
.
startPage
(
current
,
size
);
List
<
PeasantHousehold
>
records
=
peasantHouseholdMapper
.
queryForPage
(
developerCode
,
ownersName
,
developerId
,
isCertified
);
List
<
PeasantHousehold
>
records
=
peasantHouseholdMapper
.
queryForPage
(
developerCode
,
ownersName
,
developerId
,
isCertified
);
PageInfo
<
PeasantHousehold
>
objectPageInfo
=
new
PageInfo
<
PeasantHousehold
>(
records
);
PageInfo
<
PeasantHousehold
>
objectPageInfo
=
new
PageInfo
<
PeasantHousehold
>(
records
);
...
@@ -248,7 +224,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -248,7 +224,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
item
.
setIsAllRevoke
(
peasantHouseholdMapper
.
selectIsAllRevoke
(
item
.
getAmosUserId
()));
item
.
setIsAllRevoke
(
peasantHouseholdMapper
.
selectIsAllRevoke
(
item
.
getAmosUserId
()));
if
(
item
.
getSurveyOrNot
()
!=
null
)
{
if
(
item
.
getSurveyOrNot
()
!=
null
)
{
if
(
item
.
getSurveyOrNot
()
==
0
)
{
if
(
item
.
getSurveyOrNot
()
==
0
)
{
item
.
setSurveyOrNotText
(
"待勘察"
);
item
.
setSurveyOrNotText
(
"待勘察"
);
}
else
if
(
item
.
getSurveyOrNot
()
==
1
)
{
}
else
if
(
item
.
getSurveyOrNot
()
==
1
)
{
...
@@ -263,11 +239,11 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -263,11 +239,11 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
if
(!
StringUtils
.
isEmpty
(
item
.
getProjectAddressName
()))
{
if
(!
StringUtils
.
isEmpty
(
item
.
getProjectAddressName
()))
{
item
.
setProjectAddressText
(
Arrays
.
asList
(
item
.
getProjectAddressName
().
split
(
"/"
)));
item
.
setProjectAddressText
(
Arrays
.
asList
(
item
.
getProjectAddressName
().
split
(
"/"
)));
}
}
if
(!
StringUtils
.
isEmpty
(
item
.
getPermanentAddressName
()))
{
if
(!
StringUtils
.
isEmpty
(
item
.
getPermanentAddressName
()))
{
item
.
setPermanentAddressText
(
Arrays
.
asList
(
item
.
getPermanentAddressName
().
split
(
"/"
)));
item
.
setPermanentAddressText
(
Arrays
.
asList
(
item
.
getPermanentAddressName
().
split
(
"/"
)));
}
}
if
(
item
.
getProjectAddressDetail
()!=
null
)
{
if
(
item
.
getProjectAddressDetail
()
!=
null
)
{
item
.
setProjectAddressName
(
item
.
getProjectAddressName
()
+
"/"
+
item
.
getProjectAddressDetail
());
item
.
setProjectAddressName
(
item
.
getProjectAddressName
()
+
"/"
+
item
.
getProjectAddressDetail
());
}
}
return
item
;
return
item
;
...
@@ -284,8 +260,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -284,8 +260,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
/**
/**
* 列表查询 示例
* 列表查询 示例
*/
*/
public
List
<
PeasantHouseholdDto
>
queryForPeasantHouseholdList
(
@Condition
(
Operator
.
eq
)
Integer
isCertified
)
{
public
List
<
PeasantHouseholdDto
>
queryForPeasantHouseholdList
(
@Condition
(
Operator
.
eq
)
Integer
isCertified
)
{
return
this
.
queryForList
(
""
,
false
,
isCertified
);
return
this
.
queryForList
(
""
,
false
,
isCertified
);
}
}
public
Boolean
doAuthenticate
(
Long
sequenceNbr
)
{
public
Boolean
doAuthenticate
(
Long
sequenceNbr
)
{
...
@@ -301,15 +277,15 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -301,15 +277,15 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
PeasantHouseholdWxDto
wxUserLogin
(
MobileLoginParamDto
wxDTO
)
{
public
PeasantHouseholdWxDto
wxUserLogin
(
MobileLoginParamDto
wxDTO
)
{
// 通过手机号和验证码调用平台接口进行验证
// 通过手机号和验证码调用平台接口进行验证
String
phoneNo
;
String
phoneNo
;
try
{
try
{
phoneNo
=
this
.
parsePhoneNo
(
wxDTO
);
phoneNo
=
this
.
parsePhoneNo
(
wxDTO
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"解析手机号失败"
);
throw
new
RuntimeException
(
"解析手机号失败"
);
}
}
if
(
phoneNo
==
null
)
{
if
(
phoneNo
==
null
)
{
log
.
error
(
"获取手机号失败!"
);
log
.
error
(
"获取手机号失败!"
);
throw
new
RuntimeException
(
"解析手机号失败"
);
throw
new
RuntimeException
(
"解析手机号失败"
);
}
}
log
.
info
(
"用户手机号码 => {} 开始登录"
,
phoneNo
);
log
.
info
(
"用户手机号码 => {} 开始登录"
,
phoneNo
);
wxDTO
.
setPhoneNo
(
phoneNo
);
wxDTO
.
setPhoneNo
(
phoneNo
);
...
@@ -320,7 +296,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -320,7 +296,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
//判断是否非农户 如果存在即为非农户角色
//判断是否非农户 如果存在即为非农户角色
List
<
Map
<
String
,
Object
>>
maps
=
peasantHouseholdMapper
.
selectUserIsHouse
(
phoneNo
);
List
<
Map
<
String
,
Object
>>
maps
=
peasantHouseholdMapper
.
selectUserIsHouse
(
phoneNo
);
if
(
CollectionUtil
.
isNotEmpty
(
maps
)){
if
(
CollectionUtil
.
isNotEmpty
(
maps
))
{
throw
new
RuntimeException
(
"该用户非农户,请切换后登录"
);
throw
new
RuntimeException
(
"该用户非农户,请切换后登录"
);
}
}
AgencyUserModel
registerUserModel
=
null
;
AgencyUserModel
registerUserModel
=
null
;
...
@@ -331,7 +307,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -331,7 +307,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
LoginInfoModel
loginInfoModel
=
loginInfo
.
getResult
();
LoginInfoModel
loginInfoModel
=
loginInfo
.
getResult
();
if
(
loginInfoModel
==
null
||
!
StringUtils
.
isNotBlank
(
loginInfoModel
.
getLoginId
()))
{
if
(
loginInfoModel
==
null
||
!
StringUtils
.
isNotBlank
(
loginInfoModel
.
getLoginId
()))
{
// 没有认证过, 去注册用户
// 没有认证过, 去注册用户
if
(
StringUtils
.
isEmpty
(
wxDTO
.
getAmosUserId
())){
if
(
StringUtils
.
isEmpty
(
wxDTO
.
getAmosUserId
()))
{
throw
new
RuntimeException
(
"请扫描经销商开发人员区域二维码进行注册"
);
throw
new
RuntimeException
(
"请扫描经销商开发人员区域二维码进行注册"
);
}
}
// FeignClientResult<AgencyUserModel> registerUserModelRestult = doRegister(wxDTO);
// FeignClientResult<AgencyUserModel> registerUserModelRestult = doRegister(wxDTO);
...
@@ -401,7 +377,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -401,7 +377,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
}
}
public
Map
<
String
,
Object
>
getRegisterPhone
(
MobileLoginParamDto
wxDTO
)
{
public
Map
<
String
,
Object
>
getRegisterPhone
(
MobileLoginParamDto
wxDTO
)
{
// 机器人token
// 机器人token
RequestContext
.
setAppKey
(
"AMOS_STUDIO"
);
RequestContext
.
setAppKey
(
"AMOS_STUDIO"
);
RequestContext
.
setProduct
(
"AMOS_STUDIO_WEB"
);
RequestContext
.
setProduct
(
"AMOS_STUDIO_WEB"
);
...
@@ -409,36 +385,36 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -409,36 +385,36 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
PeasantHouseholdDto
peasantHouseholdDto
=
this
.
buildDefaultPeasantHouseholdDto
(
wxDTO
.
getAmosUserId
(),
wxDTO
.
getQrCodeType
(),
wxDTO
.
getPhoneNo
());
PeasantHouseholdDto
peasantHouseholdDto
=
this
.
buildDefaultPeasantHouseholdDto
(
wxDTO
.
getAmosUserId
(),
wxDTO
.
getQrCodeType
(),
wxDTO
.
getPhoneNo
());
String
phoneNo
=
null
;
String
phoneNo
=
null
;
Map
<
String
,
Object
>
resultMap
=
BeanUtil
.
beanToMap
(
peasantHouseholdDto
);
Map
<
String
,
Object
>
resultMap
=
BeanUtil
.
beanToMap
(
peasantHouseholdDto
);
resultMap
.
put
(
"isRegister"
,
1
);
resultMap
.
put
(
"isRegister"
,
1
);
try
{
try
{
phoneNo
=
this
.
parsePhoneNo
(
wxDTO
);
phoneNo
=
this
.
parsePhoneNo
(
wxDTO
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
resultMap
.
put
(
"telephone"
,
""
);
resultMap
.
put
(
"telephone"
,
""
);
return
resultMap
;
return
resultMap
;
}
}
//判断是否非农户 如果存在即为非农户角色
//判断是否非农户 如果存在即为非农户角色
List
<
Map
<
String
,
Object
>>
maps
=
peasantHouseholdMapper
.
selectUserIsHouse
(
phoneNo
);
List
<
Map
<
String
,
Object
>>
maps
=
peasantHouseholdMapper
.
selectUserIsHouse
(
phoneNo
);
if
(
CollectionUtil
.
isNotEmpty
(
maps
)){
if
(
CollectionUtil
.
isNotEmpty
(
maps
))
{
throw
new
BadRequest
(
"该手机号已注册"
);
throw
new
BadRequest
(
"该手机号已注册"
);
}
}
if
(
StringUtils
.
isNotEmpty
(
phoneNo
)){
if
(
StringUtils
.
isNotEmpty
(
phoneNo
))
{
resultMap
.
put
(
"telephone"
,
phoneNo
);
resultMap
.
put
(
"telephone"
,
phoneNo
);
FeignClientResult
<
LoginInfoModel
>
loginInfo
=
Privilege
.
agencyUserClient
.
getLoginInfo
(
phoneNo
);
FeignClientResult
<
LoginInfoModel
>
loginInfo
=
Privilege
.
agencyUserClient
.
getLoginInfo
(
phoneNo
);
List
<
PeasantHousehold
>
peasantHouseholds
=
this
.
query
().
eq
(
"telephone"
,
phoneNo
).
eq
(
"is_certified"
,
"1"
).
orderByDesc
(
"rec_date"
).
list
();
List
<
PeasantHousehold
>
peasantHouseholds
=
this
.
query
().
eq
(
"telephone"
,
phoneNo
).
eq
(
"is_certified"
,
"1"
).
orderByDesc
(
"rec_date"
).
list
();
if
(
loginInfo
!=
null
&&
200
==
loginInfo
.
getStatus
()
&&
null
!=
loginInfo
.
getResult
()
if
(
loginInfo
!=
null
&&
200
==
loginInfo
.
getStatus
()
&&
null
!=
loginInfo
.
getResult
()
&&
(
peasantHouseholds
.
size
()>
0
||
CollectionUtil
.
isNotEmpty
(
peasantHouseholds
)))
{
&&
(
peasantHouseholds
.
size
()
>
0
||
CollectionUtil
.
isNotEmpty
(
peasantHouseholds
)))
{
resultMap
.
put
(
"isRegister"
,
0
);
resultMap
.
put
(
"isRegister"
,
0
);
}
}
}
else
{
}
else
{
resultMap
.
put
(
"telephone"
,
""
);
resultMap
.
put
(
"telephone"
,
""
);
}
}
return
resultMap
;
return
resultMap
;
}
}
public
PeasantHouseholdWxDto
registerAndLogin
(
MobileLoginParamDto
wxDTO
){
public
PeasantHouseholdWxDto
registerAndLogin
(
MobileLoginParamDto
wxDTO
)
{
// 机器人token
// 机器人token
RequestContext
.
setAppKey
(
"AMOS_STUDIO"
);
RequestContext
.
setAppKey
(
"AMOS_STUDIO"
);
RequestContext
.
setProduct
(
"AMOS_STUDIO_WEB"
);
RequestContext
.
setProduct
(
"AMOS_STUDIO_WEB"
);
...
@@ -452,7 +428,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -452,7 +428,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
LoginInfoModel
loginInfoModel
=
loginInfo
.
getResult
();
LoginInfoModel
loginInfoModel
=
loginInfo
.
getResult
();
if
(
loginInfoModel
==
null
||
!
StringUtils
.
isNotBlank
(
loginInfoModel
.
getLoginId
()))
{
if
(
loginInfoModel
==
null
||
!
StringUtils
.
isNotBlank
(
loginInfoModel
.
getLoginId
()))
{
// 没有认证过, 去注册用户
// 没有认证过, 去注册用户
if
(
StringUtils
.
isEmpty
(
wxDTO
.
getAmosUserId
())){
if
(
StringUtils
.
isEmpty
(
wxDTO
.
getAmosUserId
()))
{
throw
new
RuntimeException
(
"请扫描经销商开发人员区域二维码进行注册"
);
throw
new
RuntimeException
(
"请扫描经销商开发人员区域二维码进行注册"
);
}
}
FeignClientResult
<
AgencyUserModel
>
registerUserModelRestult
=
doRegister
(
wxDTO
);
FeignClientResult
<
AgencyUserModel
>
registerUserModelRestult
=
doRegister
(
wxDTO
);
...
@@ -467,31 +443,31 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -467,31 +443,31 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
// 登录
// 登录
PeasantHouseholdWxDto
loginResult
;
PeasantHouseholdWxDto
loginResult
;
loginResult
=
doLogin
(
wxDTO
,
registerUserModel
);
loginResult
=
doLogin
(
wxDTO
,
registerUserModel
);
// 查询农户信息
// 查询农户信息
List
<
PeasantHousehold
>
peasantHouseholds
=
this
.
query
().
eq
(
"telephone"
,
wxDTO
.
getPhoneNo
()).
orderByDesc
(
"rec_date"
).
list
();
List
<
PeasantHousehold
>
peasantHouseholds
=
this
.
query
().
eq
(
"telephone"
,
wxDTO
.
getPhoneNo
()).
orderByDesc
(
"rec_date"
).
list
();
PeasantHousehold
peasantHousehold
=
peasantHouseholds
.
size
()
>
0
?
peasantHouseholds
.
get
(
0
)
:
null
;
PeasantHousehold
peasantHousehold
=
peasantHouseholds
.
size
()
>
0
?
peasantHouseholds
.
get
(
0
)
:
null
;
if
(
null
==
peasantHousehold
)
{
if
(
null
==
peasantHousehold
)
{
peasantHousehold
=
new
PeasantHousehold
();
peasantHousehold
=
new
PeasantHousehold
();
peasantHousehold
.
setIsCertified
(
0
);
peasantHousehold
.
setIsCertified
(
0
);
peasantHousehold
.
setSurveyOrNot
(
0
);
peasantHousehold
.
setSurveyOrNot
(
0
);
peasantHousehold
.
setReview
(
0
);
peasantHousehold
.
setReview
(
0
);
peasantHousehold
.
setAmosUserId
(
registerUserModel
.
getUserId
());
peasantHousehold
.
setAmosUserId
(
registerUserModel
.
getUserId
());
peasantHousehold
.
setTelephone
(
wxDTO
.
getPhoneNo
());
peasantHousehold
.
setTelephone
(
wxDTO
.
getPhoneNo
());
PeasantHouseholdDto
peasantHouseholdDto
=
buildDefaultPeasantHouseholdDto
(
wxDTO
.
getAmosUserId
(),
wxDTO
.
getQrCodeType
(),
wxDTO
.
getPhoneNo
());
PeasantHouseholdDto
peasantHouseholdDto
=
buildDefaultPeasantHouseholdDto
(
wxDTO
.
getAmosUserId
(),
wxDTO
.
getQrCodeType
(),
wxDTO
.
getPhoneNo
());
peasantHousehold
.
setDeveloperCode
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getDeveloperCode
).
orElse
(
null
));
// 开发方code
peasantHousehold
.
setDeveloperCode
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getDeveloperCode
).
orElse
(
null
));
// 开发方code
peasantHousehold
.
setDeveloperId
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getDeveloperId
).
orElse
(
null
));
// 开发方id
peasantHousehold
.
setDeveloperId
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getDeveloperId
).
orElse
(
null
));
// 开发方id
peasantHousehold
.
setDeveloperName
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getDeveloperName
).
orElse
(
null
));
// 开发方名称
peasantHousehold
.
setDeveloperName
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getDeveloperName
).
orElse
(
null
));
// 开发方名称
peasantHousehold
.
setDeveloper
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getDeveloper
).
orElse
(
null
));
// 开发人
peasantHousehold
.
setDeveloper
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getDeveloper
).
orElse
(
null
));
// 开发人
peasantHousehold
.
setDeveloperUserId
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getDeveloperUserId
).
orElse
(
null
));
peasantHousehold
.
setDeveloperUserId
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getDeveloperUserId
).
orElse
(
null
));
peasantHousehold
.
setRegionalCompaniesSeq
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getRegionalCompaniesSeq
).
orElse
(
null
));
peasantHousehold
.
setRegionalCompaniesSeq
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getRegionalCompaniesSeq
).
orElse
(
null
));
peasantHousehold
.
setRegionalCompaniesCode
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getRegionalCompaniesCode
).
orElse
(
null
));
peasantHousehold
.
setRegionalCompaniesCode
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getRegionalCompaniesCode
).
orElse
(
null
));
peasantHousehold
.
setRegionalCompaniesName
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getRegionalCompaniesName
).
orElse
(
null
));
peasantHousehold
.
setRegionalCompaniesName
(
Optional
.
ofNullable
(
peasantHouseholdDto
).
map
(
PeasantHouseholdDto:
:
getRegionalCompaniesName
).
orElse
(
null
));
peasantHousehold
.
setIsCertified
(
0
);
peasantHousehold
.
setIsCertified
(
0
);
this
.
save
(
peasantHousehold
);
this
.
save
(
peasantHousehold
);
}
}
loginResult
.
setPeasantHousehold
(
peasantHousehold
);
loginResult
.
setPeasantHousehold
(
peasantHousehold
);
return
loginResult
;
return
loginResult
;
}
}
...
@@ -625,7 +601,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -625,7 +601,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
log
.
info
(
"通过区域/个人二维码扫描组装信息, user => {}, user's companys => {}"
,
userInfo
.
getUserId
(),
JSONObject
.
toJSONString
(
userInfo
.
getCompanys
()));
log
.
info
(
"通过区域/个人二维码扫描组装信息, user => {}, user's companys => {}"
,
userInfo
.
getUserId
(),
JSONObject
.
toJSONString
(
userInfo
.
getCompanys
()));
//获取用户所在经销商单位
//获取用户所在经销商单位
UserUnitInformationDto
userUnitInformationDto
=
personnelBusinessMapper
.
getUserUnitInformationDto
(
userInfo
.
getUserId
());
UserUnitInformationDto
userUnitInformationDto
=
personnelBusinessMapper
.
getUserUnitInformationDto
(
userInfo
.
getUserId
());
// Long sequenceNbr = userInfo.getCompanys().get(0).getSequenceNbr();
// Long sequenceNbr = userInfo.getCompanys().get(0).getSequenceNbr();
// String companyOrgCode = userInfo.getCompanys().get(0).getOrgCode();
// String companyOrgCode = userInfo.getCompanys().get(0).getOrgCode();
...
@@ -635,7 +611,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -635,7 +611,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
String
companyName
=
userUnitInformationDto
.
getAmosDealerName
();
String
companyName
=
userUnitInformationDto
.
getAmosDealerName
();
// unitInfoServiceImpl.createCompanyAndUser 创建经销商的时候绑定的平台用户
// unitInfoServiceImpl.createCompanyAndUser 创建经销商的时候绑定的平台用户
// List<UnitInfo> unitInfos = unitInfoServiceImpl.list(new LambdaQueryWrapper<UnitInfo>().eq(UnitInfo::getAmosCompanySeq, sequenceNbr));
// List<UnitInfo> unitInfos = unitInfoServiceImpl.list(new LambdaQueryWrapper<UnitInfo>().eq(UnitInfo::getAmosCompanySeq, sequenceNbr));
PeasantHouseholdDto
dto
=
new
PeasantHouseholdDto
();
PeasantHouseholdDto
dto
=
new
PeasantHouseholdDto
();
// 先在后台创建一个角色和公司,微信农户新建的用户使用统一的
// 先在后台创建一个角色和公司,微信农户新建的用户使用统一的
// 用户光伏-微信农户
// 用户光伏-微信农户
...
@@ -763,14 +739,14 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -763,14 +739,14 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
* @throws
* @throws
*/
*/
public
String
getPeasantHouseholdNo
(
Long
sequenceNbr
)
{
public
String
getPeasantHouseholdNo
(
Long
sequenceNbr
)
{
RegionalCompanies
da
=
regionalCompaniesMapper
.
selectRegionName
(
sequenceNbr
);
RegionalCompanies
da
=
regionalCompaniesMapper
.
selectRegionName
(
sequenceNbr
);
if
(
da
.
getCompanyCode
()==
null
||
da
.
getCompanyCode
().
isEmpty
())
{
if
(
da
.
getCompanyCode
()
==
null
||
da
.
getCompanyCode
().
isEmpty
())
{
throw
new
BadRequest
(
"区域公司编号为空, 请设置编号"
);
throw
new
BadRequest
(
"区域公司编号为空, 请设置编号"
);
}
}
if
(
da
.
getRegionalAddress
()==
null
||
da
.
getRegionalAddress
().
isEmpty
())
{
if
(
da
.
getRegionalAddress
()
==
null
||
da
.
getRegionalAddress
().
isEmpty
())
{
throw
new
BadRequest
(
"区域公司省市区为空, 请设置省市区"
);
throw
new
BadRequest
(
"区域公司省市区为空, 请设置省市区"
);
}
}
String
code
=
NumberUtil
.
getCode
(
CodeEnum
.
农户
.
getCode
(),
da
.
getCompanyCode
(),
da
.
getRegionalAddress
());
String
code
=
NumberUtil
.
getCode
(
CodeEnum
.
农户
.
getCode
(),
da
.
getCompanyCode
(),
da
.
getRegionalAddress
());
return
code
;
return
code
;
}
}
...
@@ -787,9 +763,9 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -787,9 +763,9 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
@Override
@Override
public
List
<
PeasantHousehold
>
getInfoByIds
(
String
ids
)
{
public
List
<
PeasantHousehold
>
getInfoByIds
(
String
ids
)
{
QueryWrapper
<
PeasantHousehold
>
queryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
PeasantHousehold
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
select
(
"sequence_nbr "
,
"owners_name"
,
"concat(project_address_name,project_address_detail) as project_address_name"
);
queryWrapper
.
select
(
"sequence_nbr "
,
"owners_name"
,
"concat(project_address_name,project_address_detail) as project_address_name"
);
queryWrapper
.
in
(
"sequence_nbr"
,
Arrays
.
asList
(
ids
.
split
(
","
)));
queryWrapper
.
in
(
"sequence_nbr"
,
Arrays
.
asList
(
ids
.
split
(
","
)));
queryWrapper
.
eq
(
"is_delete"
,
0
);
queryWrapper
.
eq
(
"is_delete"
,
0
);
List
<
PeasantHousehold
>
peasantHouseholds
=
this
.
getBaseMapper
().
selectList
(
queryWrapper
);
List
<
PeasantHousehold
>
peasantHouseholds
=
this
.
getBaseMapper
().
selectList
(
queryWrapper
);
return
peasantHouseholds
;
return
peasantHouseholds
;
...
@@ -801,14 +777,14 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -801,14 +777,14 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
// 根据sequenceNbr获取农户勘察状态
// 根据sequenceNbr获取农户勘察状态
Integer
surveyOrNot
=
peasantHouseholdMapper
.
selectSurveyOrNot
(
sequenceNbr
);
Integer
surveyOrNot
=
peasantHouseholdMapper
.
selectSurveyOrNot
(
sequenceNbr
);
if
(
surveyOrNot
!=
0
)
{
if
(
surveyOrNot
!=
0
)
{
throw
new
BadRequest
(
"该用户已勘察, 不允许删除!"
);
throw
new
BadRequest
(
"该用户已勘察, 不允许删除!"
);
}
}
// 查询该条数据能否被删除, 0不能删除, 1可以删除
// 查询该条数据能否被删除, 0不能删除, 1可以删除
Integer
isAllRevok
=
peasantHouseholdMapper
.
selectIsAllRevoke
(
userId
);
Integer
isAllRevok
=
peasantHouseholdMapper
.
selectIsAllRevoke
(
userId
);
if
(
isAllRevok
!=
1
)
{
if
(
isAllRevok
!=
1
)
{
throw
new
BadRequest
(
"该用户有未完成的任务, 不允许删除!"
);
throw
new
BadRequest
(
"该用户有未完成的任务, 不允许删除!"
);
}
}
...
@@ -830,4 +806,75 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -830,4 +806,75 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
}
}
public
Map
<
String
,
Object
>
getJxsAndNhData
(
String
nhUserId
,
String
jxsUserId
,
String
qrCodeType
)
{
QueryWrapper
<
PeasantHousehold
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"amos_user_id"
,
nhUserId
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
List
<
PeasantHousehold
>
peasantHouseholds
=
this
.
getBaseMapper
().
selectList
(
queryWrapper
);
result
.
put
(
"nh"
,
peasantHouseholds
);
result
.
put
(
"jxs"
,
buildDefaultPeasantHouseholdDto
(
jxsUserId
,
qrCodeType
,
null
));
return
result
;
}
public
List
<
PeasantHousehold
>
getPeasantHouseByUserId
(
String
nhUserId
)
{
QueryWrapper
<
PeasantHousehold
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"amos_user_id"
,
nhUserId
);
return
this
.
getBaseMapper
().
selectList
(
queryWrapper
);
}
public
PeasantHouseholdDto
addNewPeasantHousehold
(
PeasantHouseholdDto
model
)
{
SurveyInformationDto
surveyInformationDto
=
new
SurveyInformationDto
();
surveyInformationDto
.
setSurveyNumber
(
this
.
getkcNo
(
model
.
getRegionalCompaniesSeq
()));
surveyInformationServiceImpl
.
createWithModel
(
surveyInformationDto
);
model
.
setSurveyInformationId
(
surveyInformationDto
.
getSequenceNbr
());
model
.
setSurveyOrNot
(
0
);
model
.
setReview
(
0
);
if
(
model
.
getCreationTime
()
==
null
)
{
model
.
setCreationTime
(
new
Date
());
}
model
.
setPeasantHouseholdNo
(
this
.
getPeasantHouseholdNo
(
model
.
getRegionalCompaniesSeq
()));
model
.
setIsCertified
(
model
.
getIsCertified
()
==
null
?
0
:
model
.
getIsCertified
());
// 未认证
PeasantHousehold
peasantHousehold
=
new
PeasantHousehold
();
BeanUtils
.
copyProperties
(
model
,
peasantHousehold
);
peasantHousehold
.
setSequenceNbr
(
null
);
peasantHousehold
.
setConstructionState
(
ArrivalStateeEnum
.
待勘察
.
getCode
());
this
.
save
(
peasantHousehold
);
//生成合同
HouseholdContract
householdContract
=
new
HouseholdContract
();
householdContract
.
setPartyA
(
peasantHousehold
.
getOwnersName
());
householdContract
.
setPeasantHouseholdNumber
(
peasantHousehold
.
getPeasantHouseholdNo
());
householdContract
.
setPeasantHouseholdCard
(
peasantHousehold
.
getIdCard
());
householdContract
.
setDealerId
(
peasantHousehold
.
getDeveloperId
());
householdContract
.
setDealerCode
(
peasantHousehold
.
getDeveloperCode
());
householdContract
.
setDealerName
(
peasantHousehold
.
getDeveloperName
());
householdContract
.
setPeasantHouseholdId
(
peasantHousehold
.
getSequenceNbr
());
householdContract
.
setRegionalCompaniesCode
(
peasantHousehold
.
getRegionalCompaniesCode
());
householdContract
.
setRegionalCompaniesName
(
peasantHousehold
.
getRegionalCompaniesName
());
householdContract
.
setRegionalCompaniesSeq
(
peasantHousehold
.
getRegionalCompaniesSeq
());
householdContract
.
setPeasantHouseholdPhone
(
peasantHousehold
.
getTelephone
());
householdContract
.
setProjectAddressDetail
(
peasantHousehold
.
getProjectAddressDetail
());
householdContract
.
setProjectAddressName
(
peasantHousehold
.
getProjectAddressName
());
householdContract
.
setPermanentAddressDetail
(
peasantHousehold
.
getPermanentAddressDetail
());
householdContract
.
setPermanentAddressName
(
peasantHousehold
.
getPermanentAddressName
());
householdContract
.
setProjectUserId
(
peasantHousehold
.
getAmosUserId
());
householdContractServiceImpl
.
addHouseholdContract
(
householdContract
);
//生成待办任务
ToDoTasks
toDoTasks
=
new
ToDoTasks
(
TaskTypeStationEnum
.
电站勘察
.
getCode
(),
peasantHousehold
.
getSequenceNbr
(),
"用户"
+
householdContract
.
getPartyA
()
+
"电站信息勘察"
,
householdContract
.
getDealerCode
());
toDoTasksServiceImpl
.
addToDoTasksByUserId
(
peasantHousehold
.
getDeveloperUserId
(),
toDoTasks
,
""
);
ToDoTasks
toDoTasks1
=
new
ToDoTasks
(
TaskTypeStationEnum
.
合同填报
.
getCode
(),
householdContract
.
getSequenceNbr
(),
"用户"
+
householdContract
.
getPartyA
()
+
"的合同待发起"
,
householdContract
.
getDealerCode
());
toDoTasksServiceImpl
.
addToDoTasksByUserId
(
peasantHousehold
.
getDeveloperUserId
(),
toDoTasks1
,
""
);
return
model
;
}
public
IPage
<
PeasantHousehold
>
getPeasantHousePage
(
PeasantHouseholdPageDto
peasantHouseholdPageDto
)
{
QueryWrapper
<
PeasantHousehold
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"amos_user_id"
,
peasantHouseholdPageDto
.
getNhUserId
());
queryWrapper
.
like
(
StrUtil
.
isNotEmpty
(
peasantHouseholdPageDto
.
getPeasantHouseholdNo
()),
"peasant_household_no"
,
"%"
+
peasantHouseholdPageDto
.
getPeasantHouseholdNo
()+
"%"
);
return
this
.
baseMapper
.
selectPage
(
new
Page
<>(
peasantHouseholdPageDto
.
getCurrent
(),
peasantHouseholdPageDto
.
getSize
()),
queryWrapper
);
}
}
}
\ No newline at end of file
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