Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
a240e2a2
Commit
a240e2a2
authored
Mar 22, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新接口
parent
6eb85665
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
253 additions
and
26 deletions
+253
-26
HouseholdPvDto.java
...eejoin/amos/boot/module/jxiop/api/dto/HouseholdPvDto.java
+3
-0
HouseholdPvDistrict.java
...mos/boot/module/jxiop/api/entity/HouseholdPvDistrict.java
+3
-0
HouseholdPvDistrictMapper.java
...ot/module/jxiop/api/mapper/HouseholdPvDistrictMapper.java
+8
-0
HouseholdPvMapper.java
.../amos/boot/module/jxiop/api/mapper/HouseholdPvMapper.java
+4
-0
IHouseholdPvDistrictService.java
...module/jxiop/api/service/IHouseholdPvDistrictService.java
+7
-1
HouseholdPvDistrictMapper.xml
...i/src/main/resources/mapper/HouseholdPvDistrictMapper.xml
+20
-0
HouseholdPvMapper.xml
...jxiop-api/src/main/resources/mapper/HouseholdPvMapper.xml
+21
-0
HouseholdPvController.java
...ot/module/jxiop/biz/controller/HouseholdPvController.java
+2
-2
HouseholdPvDistrictController.java
...e/jxiop/biz/controller/HouseholdPvDistrictController.java
+39
-4
HouseholdPvDistrictServiceImpl.java
...xiop/biz/service/impl/HouseholdPvDistrictServiceImpl.java
+51
-4
HouseholdPvServiceImpl.java
...module/jxiop/biz/service/impl/HouseholdPvServiceImpl.java
+95
-15
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/dto/HouseholdPvDto.java
View file @
a240e2a2
...
...
@@ -36,6 +36,9 @@ public class HouseholdPvDto extends BaseDto {
@ApiModelProperty
(
value
=
"厂商"
)
private
Long
platformCompanyId
;
@ApiModelProperty
(
value
=
"厂站名称"
)
private
String
platformCompanyName
;
@ApiModelProperty
(
value
=
"性别"
)
private
String
sex
;
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/entity/HouseholdPvDistrict.java
View file @
a240e2a2
...
...
@@ -46,4 +46,7 @@ public class HouseholdPvDistrict extends BaseEntity {
@TableField
(
"parent_type"
)
private
String
parentType
;
@TableField
(
"biz_org_code"
)
private
String
bizOrgCode
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/mapper/HouseholdPvDistrictMapper.java
View file @
a240e2a2
...
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.api.mapper;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.CompanyTreeDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPvDistrict
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -15,4 +16,11 @@ import java.util.List;
public
interface
HouseholdPvDistrictMapper
extends
BaseMapper
<
HouseholdPvDistrict
>
{
List
<
CompanyTreeDto
>
getList
();
Integer
countTreeNodesById
(
@Param
(
"id"
)
Long
id
);
Integer
countHouseholdById
(
@Param
(
"id"
)
Long
id
);
List
<
Long
>
selectIds
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/mapper/HouseholdPvMapper.java
View file @
a240e2a2
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
mapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDeviceDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvExport
;
...
...
@@ -22,4 +23,7 @@ public interface HouseholdPvMapper extends BaseMapper<HouseholdPv> {
List
<
HouseholdPvExport
>
selectExportList
(
@Param
(
"dto"
)
HouseholdPvDto
dto
,
@Param
(
"ids"
)
List
<
Long
>
ids
);
List
<
HouseholdPvDeviceDto
>
selectEquipList
(
@Param
(
"id"
)
Long
id
);
Page
<
HouseholdPvDto
>
selectPageMessage
(
@Param
(
"page"
)
Page
<
HouseholdPvDto
>
page
,
@Param
(
"dto"
)
HouseholdPvDto
dto
,
@Param
(
"ids"
)
List
<
Long
>
ids
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/service/IHouseholdPvDistrictService.java
View file @
a240e2a2
...
...
@@ -15,5 +15,11 @@ import java.util.List;
*/
public
interface
IHouseholdPvDistrictService
extends
IService
<
HouseholdPvDistrict
>{
List
<
CompanyTreeDto
>
getTree
(
HouseholdPvDto
dto
);
List
<
CompanyTreeDto
>
getTree
();
HouseholdPvDistrict
treeAdd
(
Long
parentId
,
String
name
);
HouseholdPvDistrict
treeUpdate
(
Long
id
,
String
name
);
void
treeNodesRemove
(
Long
id
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/resources/mapper/HouseholdPvDistrictMapper.xml
View file @
a240e2a2
...
...
@@ -7,4 +7,24 @@
from household_pv_district hpd
where is_delete = 0
</select>
<select
id=
"countTreeNodesById"
resultType=
"java.lang.Integer"
>
SELECT
COUNT( 1 )
FROM
household_pv_district hpd
WHERE
hpd.parent_id = #{id}
</select>
<select
id=
"countHouseholdById"
resultType=
"java.lang.Integer"
>
SELECT COUNT(1)
FROM household_pv hp
WHERE hp.platform_company_id IN
(SELECT hpd.sequence_nbr
FROM household_pv_district hpd
WHERE hpd.sequence_nbr = #{id} OR hpd.parent_id = #{id})
</select>
<select
id=
"selectIds"
resultType=
"java.lang.Long"
>
select hp.sequence_nbr from household_pv_district hp where hp.biz_org_code like concat(#{bizOrgCode}, '%')
</select>
</mapper>
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/resources/mapper/HouseholdPvMapper.xml
View file @
a240e2a2
...
...
@@ -60,4 +60,25 @@
<select
id=
"selectEquipList"
resultType=
"com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDeviceDto"
>
SELECT * from household_pv_device hpd WHERE hpd.household_pv_id = #{id}
</select>
<select
id=
"selectPageMessage"
resultType=
"com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDto"
>
select * from household_pv hp
<where>
<if
test=
"dto.name != null and dto.name != ''"
>
and hp.name like concat('%',#{dto.name},'%')
</if>
<if
test=
"dto.residenceAddress != null and dto.residenceAddress != ''"
>
and hp.residence_address like concat('%',#{residenceAddress},'%')
</if>
<if
test=
"dto.number != null and dto.number != ''"
>
and hp.number like concat('%',#{dto.number},'%')
</if>
<if
test=
"ids != null and ids.size > 0"
>
and hp.platform_company_id in
<foreach
collection=
"ids"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/HouseholdPvController.java
View file @
a240e2a2
...
...
@@ -114,10 +114,10 @@ public class HouseholdPvController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"户用光伏表分页查询"
,
notes
=
"户用光伏表分页查询"
)
public
ResponseModel
<
IPage
<
HouseholdPv
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
String
current
,
public
ResponseModel
<
IPage
<
HouseholdPv
Dto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
String
current
,
@RequestParam
(
value
=
"size"
)
String
size
,
HouseholdPvDto
dto
)
{
Page
<
HouseholdPv
>
page
=
new
Page
<>();
Page
<
HouseholdPv
Dto
>
page
=
new
Page
<>();
page
.
setCurrent
(
Long
.
parseLong
(
current
));
page
.
setSize
(
Long
.
parseLong
(
size
));
return
ResponseHelper
.
buildResponse
(
householdPvServiceImpl
.
queryForHouseholdPvPage
(
page
,
dto
));
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/HouseholdPvDistrictController.java
View file @
a240e2a2
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.CompanyTreeDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDistrictDto
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPvDistrict
;
import
com.yeejoin.amos.boot.module.jxiop.api.service.IHouseholdPvDistrictService
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.HouseholdPvDistrictServiceImpl
;
import
io.swagger.annotations.Api
;
...
...
@@ -16,6 +19,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author system_generator
...
...
@@ -120,7 +124,7 @@ public class HouseholdPvDistrictController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"厂站树"
,
notes
=
"厂站树"
)
public
ResponseModel
<
Object
>
getTree
()
{
return
ResponseHelper
.
buildResponse
(
householdPvDistrictService
.
getTree
(
null
));
return
ResponseHelper
.
buildResponse
(
householdPvDistrictService
.
getTree
());
}
/**
...
...
@@ -131,8 +135,39 @@ public class HouseholdPvDistrictController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/treeAdd"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"树节点新增"
,
notes
=
"树节点新增"
)
public
ResponseModel
<
HouseholdPvDistrictDto
>
treeAdd
(
@RequestBody
HouseholdPvDistrictDto
model
)
{
model
=
householdPvDistrictServiceImpl
.
createWithModel
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
public
ResponseModel
<
HouseholdPvDistrict
>
treeAdd
(
@RequestBody
JSONObject
model
)
{
Map
<
String
,
Object
>
dto
=
(
Map
<
String
,
Object
>)
model
.
get
(
"dto"
);
String
id
=
dto
.
get
(
"id"
).
toString
();
String
name
=
dto
.
get
(
"name"
).
toString
();
HouseholdPvDistrict
householdPvDistrict
=
householdPvDistrictService
.
treeAdd
(
Long
.
parseLong
(
id
),
name
);
return
ResponseHelper
.
buildResponse
(
householdPvDistrict
);
}
/**
* 树节点新增
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/treeUpdate"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"树节点新增"
,
notes
=
"树节点新增"
)
public
ResponseModel
<
HouseholdPvDistrict
>
treeUpdate
(
@RequestBody
JSONObject
model
)
{
Map
<
String
,
Object
>
dto
=
(
Map
<
String
,
Object
>)
model
.
get
(
"dto"
);
String
id
=
dto
.
get
(
"id"
).
toString
();
String
name
=
dto
.
get
(
"name"
).
toString
();
HouseholdPvDistrict
householdPvDistrict
=
householdPvDistrictService
.
treeUpdate
(
Long
.
parseLong
(
id
),
name
);
return
ResponseHelper
.
buildResponse
(
householdPvDistrict
);
}
/**
* 树节点删除
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/treeNodesRemove"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"树节点删除"
,
notes
=
"树节点删除"
)
public
ResponseModel
<
Object
>
treeNodesRemove
(
@RequestParam
(
"id"
)
String
id
)
{
householdPvDistrictService
.
treeNodesRemove
(
Long
.
parseLong
(
id
));
return
ResponseHelper
.
buildResponse
(
"ok"
);
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/HouseholdPvDistrictServiceImpl.java
View file @
a240e2a2
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.CompanyTreeDto
;
...
...
@@ -13,13 +16,17 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.HouseholdPvDistrictMapper;
import
com.yeejoin.amos.boot.module.jxiop.api.service.IHouseholdPvDistrictService
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.UserOrgTreeModel
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.joda.time.DateTimeUtils
;
import
org.joda.time.LocalDate
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.Collection
;
import
java.util.List
;
...
...
@@ -58,7 +65,50 @@ public class HouseholdPvDistrictServiceImpl extends BaseService<HouseholdPvDistr
}
@Override
public
List
<
CompanyTreeDto
>
getTree
(
HouseholdPvDto
dto
)
{
public
HouseholdPvDistrict
treeAdd
(
Long
parentId
,
String
name
)
{
String
random
=
""
+
Math
.
random
();
String
substring
=
random
.
substring
(
random
.
length
()
-
4
);
HouseholdPvDistrict
householdPvDistrict
=
new
HouseholdPvDistrict
();
householdPvDistrict
.
setName
(
name
);
householdPvDistrict
.
setParentId
(
parentId
);
householdPvDistrict
.
setCreateTime
(
LocalDate
.
now
().
toDate
());
HouseholdPvDistrict
parentDetail
=
householdPvDistrictMapper
.
selectById
(
parentId
);
if
(
ObjectUtils
.
isEmpty
(
parentDetail
))
{
FeignClientResult
<
CompanyModel
>
companyModelFeignClientResult
=
Privilege
.
companyClient
.
seleteOne
(
parentId
);
CompanyModel
result
=
companyModelFeignClientResult
.
getResult
();
if
(!
ObjectUtils
.
isEmpty
(
result
))
{
householdPvDistrict
.
setBizOrgCode
(
result
.
getOrgCode
()
+
"*"
+
substring
);
}
}
else
{
householdPvDistrict
.
setBizOrgCode
(
parentDetail
.
getBizOrgCode
()
+
"*"
+
substring
);
}
householdPvDistrictMapper
.
insert
(
householdPvDistrict
);
return
householdPvDistrict
;
}
@Override
public
HouseholdPvDistrict
treeUpdate
(
Long
id
,
String
name
)
{
HouseholdPvDistrict
householdPvDistrict
=
new
HouseholdPvDistrict
();
householdPvDistrict
.
setSequenceNbr
(
id
);
householdPvDistrict
.
setName
(
name
);
this
.
updateById
(
householdPvDistrict
);
return
householdPvDistrict
;
}
@Override
public
void
treeNodesRemove
(
Long
id
)
{
Integer
treeNodes
=
householdPvDistrictMapper
.
countTreeNodesById
(
id
);
Integer
integer
=
householdPvDistrictMapper
.
countHouseholdById
(
id
);
if
(
treeNodes
>
0
)
{
throw
new
BadRequest
(
"该节点存在子节点"
);
}
else
if
(
integer
>
0
)
{
throw
new
BadRequest
(
"该节点已绑定户用光伏信息"
);
}
this
.
removeById
(
id
);
}
@Override
public
List
<
CompanyTreeDto
>
getTree
()
{
ReginParams
reginParams
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
Long
sequenceNbr
=
reginParams
.
getCompany
().
getSequenceNbr
();
FeignClientResult
<
Collection
<
UserOrgTreeModel
>>
collectionFeignClientResult
=
Privilege
.
companyClient
.
queryOrgTree
(
sequenceNbr
);
...
...
@@ -67,9 +117,6 @@ public class HouseholdPvDistrictServiceImpl extends BaseService<HouseholdPvDistr
Collection
<
UserOrgTreeModel
>
result
=
collectionFeignClientResult
.
getResult
();
change
(
result
,
list
);
}
// list.forEach(item ->{
// item.setChildren(getCompanyBuildingChildrenTree(item.getId(), list));
// });
return
list
.
stream
().
filter
(
a
->
list
.
stream
().
noneMatch
(
c
->
c
.
getId
().
equals
(
a
.
getParentId
()))).
peek
(
b
->
b
.
setChildren
(
getCompanyBuildingChildrenTree
(
b
.
getId
(),
list
))).
collect
(
Collectors
.
toList
());
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/HouseholdPvServiceImpl.java
View file @
a240e2a2
...
...
@@ -15,6 +15,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.entity.*;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.HouseholdPvDistrictMapper
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.UserOrgTreeModel
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -62,25 +63,65 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
@Autowired
HouseholdPvDistrictMapper
householdPvDistrictMapper
;
@Autowired
RedisUtils
redisUtils
;
/**
* 分页查询
*/
public
IPage
<
HouseholdPv
>
queryForHouseholdPvPage
(
Page
<
HouseholdPv
>
page
,
HouseholdPvDto
dto
)
{
LambdaQueryWrapper
<
HouseholdPv
>
lambda
=
new
QueryWrapper
<
HouseholdPv
>().
lambda
();
lambda
.
eq
(
HouseholdPv:
:
getIsDelete
,
false
);
if
(!
ObjectUtils
.
isEmpty
(
dto
.
getName
()))
{
lambda
.
like
(
HouseholdPv:
:
getName
,
dto
.
getName
());
}
// if (!ObjectUtils.isEmpty(dto.getPlatformCompanyId())) {
// lambda.eq(HouseholdPv::getPlatformCompanyId, dto.getPlatformCompanyId());
// }
if
(!
ObjectUtils
.
isEmpty
(
dto
.
getAddress
()))
{
lambda
.
like
(
HouseholdPv:
:
getAddress
,
dto
.
getAddress
());
public
IPage
<
HouseholdPvDto
>
queryForHouseholdPvPage
(
Page
<
HouseholdPvDto
>
page
,
HouseholdPvDto
dto
)
{
String
bizOrgCode
=
null
;
List
<
Long
>
ids
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
dto
.
getPlatformCompanyId
()))
{
HouseholdPvDistrict
parentDetail
=
householdPvDistrictMapper
.
selectById
(
dto
.
getPlatformCompanyId
());
if
(
ObjectUtils
.
isEmpty
(
parentDetail
))
{
FeignClientResult
<
CompanyModel
>
companyModelFeignClientResult
=
Privilege
.
companyClient
.
seleteOne
(
dto
.
getPlatformCompanyId
());
CompanyModel
result
=
companyModelFeignClientResult
.
getResult
();
if
(!
ObjectUtils
.
isEmpty
(
result
))
{
bizOrgCode
=
result
.
getOrgCode
();
}
}
else
{
bizOrgCode
=
parentDetail
.
getBizOrgCode
();
}
if
(!
ObjectUtils
.
isEmpty
(
bizOrgCode
))
{
ids
=
householdPvDistrictMapper
.
selectIds
(
bizOrgCode
);
if
(
ObjectUtils
.
isEmpty
(
ids
))
{
return
new
Page
<>();
}
}
}
if
(!
ObjectUtils
.
isEmpty
(
dto
.
getNumber
()))
{
lambda
.
like
(
HouseholdPv:
:
getNumber
,
dto
.
getNumber
());
Page
<
HouseholdPvDto
>
householdPvDtoPage
=
householdPvMapper
.
selectPageMessage
(
page
,
dto
,
ids
);
Map
<
String
,
Object
>
map
=
companyList
();
householdPvDtoPage
.
getRecords
().
forEach
(
data
->
{
data
.
setPlatformCompanyName
(
String
.
valueOf
(
map
.
get
(
data
.
getPlatformCompanyId
().
toString
())));
});
return
householdPvDtoPage
;
}
private
Map
<
String
,
Object
>
companyList
()
{
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
ReginParams
reginParams
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
Long
sequenceNbr
=
reginParams
.
getCompany
().
getSequenceNbr
();
FeignClientResult
<
Collection
<
UserOrgTreeModel
>>
collectionFeignClientResult
=
Privilege
.
companyClient
.
queryOrgTree
(
sequenceNbr
);
List
<
CompanyTreeDto
>
list
=
householdPvDistrictMapper
.
getList
();
list
.
forEach
(
item
->
{
map
.
put
(
item
.
getId
(),
item
.
getName
());
});
if
(
collectionFeignClientResult
!=
null
)
{
Collection
<
UserOrgTreeModel
>
result
=
collectionFeignClientResult
.
getResult
();
change
(
result
,
map
);
}
return
householdPvMapper
.
selectPage
(
page
,
lambda
);
return
map
;
}
private
void
change
(
Collection
<
UserOrgTreeModel
>
data
,
Map
<
String
,
Object
>
result
)
{
data
.
forEach
(
item
->
{
result
.
put
(
item
.
getId
(),
item
.
getName
());
if
(!
ObjectUtils
.
isEmpty
(
item
.
getChildren
()))
{
change
(
item
.
getChildren
(),
result
);
}
});
}
/**
...
...
@@ -93,8 +134,10 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
@Override
public
void
importData
(
List
<
HouseholdPvImport
>
list
)
{
ArrayList
<
HouseholdPv
>
householdPvs
=
new
ArrayList
<>();
Map
<
String
,
Object
>
map
=
companyNameList
();
list
.
forEach
(
item
->
{
HouseholdPv
householdPv
=
new
HouseholdPv
();
BeanUtils
.
copyProperties
(
item
,
householdPv
,
"platformCompanyId"
,
"expiryTime"
);
householdPv
.
setCreateTime
(
LocalDateTime
.
now
().
toDate
());
if
(!
ObjectUtils
.
isEmpty
(
item
.
getExpiryTime
()))
{
try
{
...
...
@@ -104,16 +147,53 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
e
.
printStackTrace
();
}
}
BeanUtils
.
copyProperties
(
item
,
householdPv
);
if
(!
ObjectUtils
.
isEmpty
(
item
.
getPlatformCompanyId
()))
{
if
(
map
.
containsKey
(
item
.
getPlatformCompanyId
()))
{
householdPv
.
setPlatformCompanyId
(
Long
.
parseLong
(
String
.
valueOf
(
map
.
get
(
item
.
getPlatformCompanyId
()))));
}
}
householdPvs
.
add
(
householdPv
);
});
this
.
saveBatch
(
householdPvs
);
}
private
Map
<
String
,
Object
>
companyNameList
()
{
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
ReginParams
reginParams
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
Long
sequenceNbr
=
reginParams
.
getCompany
().
getSequenceNbr
();
FeignClientResult
<
Collection
<
UserOrgTreeModel
>>
collectionFeignClientResult
=
Privilege
.
companyClient
.
queryOrgTree
(
sequenceNbr
);
List
<
CompanyTreeDto
>
list
=
householdPvDistrictMapper
.
getList
();
list
.
forEach
(
item
->
{
map
.
put
(
item
.
getName
(),
item
.
getId
());
});
if
(
collectionFeignClientResult
!=
null
)
{
Collection
<
UserOrgTreeModel
>
result
=
collectionFeignClientResult
.
getResult
();
changeName
(
result
,
map
);
}
return
map
;
}
private
void
changeName
(
Collection
<
UserOrgTreeModel
>
data
,
Map
<
String
,
Object
>
result
)
{
data
.
forEach
(
item
->
{
result
.
put
(
item
.
getName
(),
item
.
getId
());
if
(!
ObjectUtils
.
isEmpty
(
item
.
getChildren
()))
{
changeName
(
item
.
getChildren
(),
result
);
}
});
}
@Override
public
List
<
HouseholdPvExport
>
selectExportList
(
HouseholdPvDto
dto
,
List
<
Long
>
ids
)
{
Map
<
String
,
Object
>
companyMap
=
companyList
();
List
<
HouseholdPvExport
>
householdPvExports
=
householdPvMapper
.
selectExportList
(
dto
,
ids
);
householdPvExports
.
forEach
(
item
->
{
if
(!
ObjectUtils
.
isEmpty
(
item
.
getPlatformCompanyId
()))
{
if
(
companyMap
.
containsKey
(
item
.
getPlatformCompanyId
()))
{
item
.
setPlatformCompanyId
(
companyMap
.
get
(
item
.
getPlatformCompanyId
()).
toString
());
}
else
{
item
.
setPlatformCompanyId
(
""
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
item
.
getPeriod
()))
{
JSONArray
objects
=
JSON
.
parseArray
(
item
.
getPeriod
());
if
(!
ObjectUtils
.
isEmpty
(
objects
)
&&
objects
.
size
()
>=
2
)
{
...
...
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