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
80a2ea92
Commit
80a2ea92
authored
Dec 27, 2024
by
朱晨阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加修改农户地址接口
parent
1a238f23
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
6 deletions
+108
-6
PeasantHouseholdController.java
...odule/hygf/biz/controller/PeasantHouseholdController.java
+18
-0
PeasantHouseholdServiceImpl.java
...le/hygf/biz/service/impl/PeasantHouseholdServiceImpl.java
+89
-2
SurveyInformationServiceImpl.java
...e/hygf/biz/service/impl/SurveyInformationServiceImpl.java
+1
-4
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/PeasantHouseholdController.java
View file @
80a2ea92
...
@@ -2,8 +2,10 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
...
@@ -2,8 +2,10 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
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.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.PeasantHouseholdEnum
;
import
com.yeejoin.amos.boot.module.hygf.api.Enum.PeasantHouseholdEnum
;
import
com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower
;
import
com.yeejoin.amos.boot.module.hygf.api.config.UserEmpower
;
...
@@ -13,7 +15,9 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationEngineeringInfoAllD
...
@@ -13,7 +15,9 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationEngineeringInfoAllD
import
com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInformationDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.SurveyInformationDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.UserUnitInformationDto
;
import
com.yeejoin.amos.boot.module.hygf.api.dto.UserUnitInformationDto
;
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.entity.PowerStation
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.PersonnelBusinessMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.PersonnelBusinessMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.PeasantHouseholdServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.PeasantHouseholdServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.SurveyInformationServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.SurveyInformationServiceImpl
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
...
@@ -164,6 +168,20 @@ public class PeasantHouseholdController extends BaseController {
...
@@ -164,6 +168,20 @@ public class PeasantHouseholdController extends BaseController {
}
}
/**
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/updateAddress/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新农户地址"
,
notes
=
"根据sequenceNbr更新农户地址"
)
public
ResponseModel
updateAddress
(
@RequestBody
PeasantHouseholdDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
peasantHouseholdServiceImpl
.
updateAddress
(
model
,
sequenceNbr
);
return
CommonResponseNewUtil
.
success
();
}
/**
* 根据sequenceNbr删除
* 根据sequenceNbr删除
*
*
* @param sequenceNbr 主键
* @param sequenceNbr 主键
...
...
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 @
80a2ea92
...
@@ -5,9 +5,11 @@ import cn.hutool.core.collection.CollectionUtil;
...
@@ -5,9 +5,11 @@ import cn.hutool.core.collection.CollectionUtil;
import
cn.hutool.core.util.BooleanUtil
;
import
cn.hutool.core.util.BooleanUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONArray
;
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.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
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
;
...
@@ -27,6 +29,8 @@ import com.yeejoin.amos.component.robot.AmosRequestContext;
...
@@ -27,6 +29,8 @@ import com.yeejoin.amos.component.robot.AmosRequestContext;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.*
;
import
com.yeejoin.amos.feign.privilege.model.*
;
import
com.yeejoin.amos.feign.privilege.util.DesUtil
;
import
com.yeejoin.amos.feign.privilege.util.DesUtil
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
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.BeanUtils
;
...
@@ -56,7 +60,10 @@ import java.util.stream.Collectors;
...
@@ -56,7 +60,10 @@ 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
{
@Autowired
RedisUtils
redisUtils
;
private
static
final
String
regionRedis
=
"app_region_redis"
;
public
static
final
String
SECRETKEY
=
"qaz"
;
public
static
final
String
SECRETKEY
=
"qaz"
;
@Autowired
@Autowired
SurveyInformationServiceImpl
surveyInformationService
;
SurveyInformationServiceImpl
surveyInformationService
;
...
@@ -92,6 +99,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -92,6 +99,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
ToDoTasksServiceImpl
toDoTasksServiceImpl
;
ToDoTasksServiceImpl
toDoTasksServiceImpl
;
@Autowired
@Autowired
RegionalCompaniesMapper
regionalCompaniesMapper
;
RegionalCompaniesMapper
regionalCompaniesMapper
;
@Autowired
PowerStationServiceImpl
powerStationService
;
private
Long
TOKEN_TIME
=
1209600
l
;
private
Long
TOKEN_TIME
=
1209600
l
;
// @Autowired
// @Autowired
// CommonServiceImpl commonService;
// CommonServiceImpl commonService;
...
@@ -136,8 +145,6 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -136,8 +145,6 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
@Value
(
"${farmer.registerPassword}"
)
@Value
(
"${farmer.registerPassword}"
)
private
String
registerPassword
;
private
String
registerPassword
;
@Autowired
private
RedisUtils
redisUtils
;
@Autowired
@Autowired
private
IWxService
wxService
;
private
IWxService
wxService
;
...
@@ -263,6 +270,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -263,6 +270,8 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
return
code
;
return
code
;
}
}
/**
/**
* 分页查询
* 分页查询
*/
*/
...
@@ -1044,6 +1053,84 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
...
@@ -1044,6 +1053,84 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
return
peasantHouseholdIPage
;
return
peasantHouseholdIPage
;
}
}
public
JSONArray
getRegionName
(){
JSONArray
jsonArray
=
new
JSONArray
();
if
(
redisUtils
.
hasKey
(
regionRedis
))
{
jsonArray
=
JSONArray
.
parseArray
(
redisUtils
.
get
(
regionRedis
).
toString
());
}
else
{
Collection
<
RegionModel
>
regionChild
=
new
ArrayList
<>();
RegionModel
regionModel1
=
new
RegionModel
();
regionChild
.
add
(
regionModel1
);
FeignClientResult
<
Collection
<
RegionModel
>>
collectionFeignClientResult
=
Systemctl
.
regionClient
.
queryForTreeParent
(
610000L
);
Collection
<
RegionModel
>
result
=
collectionFeignClientResult
.
getResult
();
for
(
RegionModel
regionModel
:
result
)
{
if
(
null
!=
regionModel
&&
null
!=
regionModel
.
getChildren
())
{
for
(
RegionModel
child
:
regionModel
.
getChildren
())
{
if
(
null
!=
child
&&
null
!=
child
.
getChildren
())
{
for
(
RegionModel
childChild
:
child
.
getChildren
())
{
jsonArray
.
add
(
childChild
);
}
child
.
setChildren
(
regionChild
);
jsonArray
.
add
(
child
);
}
}
regionModel
.
setChildren
(
regionChild
);
jsonArray
.
add
(
regionModel
);
}
}
redisUtils
.
set
(
regionRedis
,
jsonArray
);
}
return
jsonArray
;
}
public
void
updateAddress
(
PeasantHouseholdDto
model
,
Long
sequenceNbr
)
{
JSONArray
regionName
=
getRegionName
();
List
<
RegionModel
>
list
=
JSONArray
.
parseArray
(
regionName
.
toJSONString
(),
RegionModel
.
class
);
if
(
model
.
getProjectAddress
().
size
()>
0
){
// 处理项目地址
String
projectAddressName
=
""
;
for
(
Integer
reg
:
model
.
getProjectAddress
())
for
(
RegionModel
re
:
list
)
{
if
(
re
.
getRegionCode
().
equals
(
Integer
.
valueOf
(
reg
)))
{
projectAddressName
=
projectAddressName
+
re
.
getRegionName
()
+
"/"
;
}
}
model
.
setProjectAddressName
(
projectAddressName
.
substring
(
0
,
projectAddressName
.
length
()
-
1
));
}
if
(
"1"
.
equals
(
model
.
getIsPermanent
()))
{
model
.
setPermanentAddress
(
model
.
getProjectAddress
());
model
.
setPermanentAddressDetail
(
model
.
getProjectAddressDetail
());
}
if
(
model
.
getPermanentAddress
().
size
()>
0
){
// 处理常驻地址
String
permanentAddressName
=
""
;
for
(
Integer
reg
:
model
.
getPermanentAddress
())
for
(
RegionModel
re
:
list
)
{
if
(
re
.
getRegionCode
().
equals
(
Integer
.
valueOf
(
reg
)))
{
permanentAddressName
=
permanentAddressName
+
re
.
getRegionName
()
+
"/"
;
}
}
model
.
setPermanentAddressName
(
permanentAddressName
.
substring
(
0
,
permanentAddressName
.
length
()
-
1
));
}
LambdaUpdateWrapper
<
PeasantHousehold
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
BaseEntity:
:
getSequenceNbr
,
sequenceNbr
);
updateWrapper
.
set
(
PeasantHousehold:
:
getPermanentAddress
,
model
.
getPermanentAddress
());
updateWrapper
.
set
(
PeasantHousehold:
:
getPermanentAddressName
,
model
.
getPermanentAddressName
());
updateWrapper
.
set
(
PeasantHousehold:
:
getPermanentAddressDetail
,
model
.
getPermanentAddressDetail
());
updateWrapper
.
set
(
PeasantHousehold:
:
getProjectAddress
,
model
.
getProjectAddress
());
updateWrapper
.
set
(
PeasantHousehold:
:
getProjectAddressDetail
,
model
.
getProjectAddressDetail
());
updateWrapper
.
set
(
PeasantHousehold:
:
getProjectAddressName
,
model
.
getProjectAddressName
());
this
.
update
(
updateWrapper
);
LambdaUpdateWrapper
<
PowerStation
>
up
=
new
LambdaUpdateWrapper
<>();
up
.
eq
(
PowerStation:
:
getPeasantHouseholdId
,
sequenceNbr
);
up
.
set
(
PowerStation:
:
getProjectAddress
,
model
.
getProjectAddressName
());
powerStationService
.
update
(
up
);
}
// public void saveHistoryPeasantHousehold(PowerStationEngineeringInfoAllDto surveyInfoAllDto,String operationType) {
// public void saveHistoryPeasantHousehold(PowerStationEngineeringInfoAllDto surveyInfoAllDto,String operationType) {
//
//
// SurveyInformationDto model = surveyInfoAllDto.getSurveyInformation();
// SurveyInformationDto model = surveyInfoAllDto.getSurveyInformation();
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/SurveyInformationServiceImpl.java
View file @
80a2ea92
...
@@ -294,10 +294,7 @@ public class SurveyInformationServiceImpl
...
@@ -294,10 +294,7 @@ public class SurveyInformationServiceImpl
}
}
peasantHousehold
peasantHousehold
.
setPermanentAddressName
(
permanentAddressName
.
substring
(
0
,
permanentAddressName
.
length
()
-
1
));
.
setPermanentAddressName
(
permanentAddressName
.
substring
(
0
,
permanentAddressName
.
length
()
-
1
));
if
(
ObjectUtils
.
isNotEmpty
(
powerStation
)){
powerStation
.
setProjectAddress
(
projectAddressName
.
substring
(
0
,
projectAddressName
.
length
()
-
1
));
powerStationMapper
.
updateById
(
powerStation
);
}
if
(
OPERATION_TYPE_SUBMIT
.
equals
(
operationType
))
{
if
(
OPERATION_TYPE_SUBMIT
.
equals
(
operationType
))
{
// peasantHousehold.setSurveyOrNot(1);
// peasantHousehold.setSurveyOrNot(1);
...
...
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