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
73756915
Commit
73756915
authored
Mar 31, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
parent
e50a5968
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
112 additions
and
77 deletions
+112
-77
IHouseholdPvService.java
...os/boot/module/jxiop/api/service/IHouseholdPvService.java
+2
-1
HouseholdPvController.java
...ot/module/jxiop/biz/controller/HouseholdPvController.java
+3
-72
HouseholdPvDistrictController.java
...e/jxiop/biz/controller/HouseholdPvDistrictController.java
+3
-3
HouseholdPvServiceImpl.java
...module/jxiop/biz/service/impl/HouseholdPvServiceImpl.java
+104
-1
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/service/IHouseholdPvService.java
View file @
73756915
...
...
@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvDto;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvExport
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.HouseholdPvImport
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPv
;
import
com.yeejoin.amos.boot.module.jxiop.api.util.CommonResponse
;
import
com.yeejoin.amos.feign.privilege.model.UserOrgTreeModel
;
/**
...
...
@@ -20,7 +21,7 @@ import com.yeejoin.amos.feign.privilege.model.UserOrgTreeModel;
*/
public
interface
IHouseholdPvService
extends
IService
<
HouseholdPv
>{
void
importData
(
List
<
HouseholdPvImport
>
list
);
CommonResponse
importData
(
List
<
HouseholdPvImport
>
list
);
List
<
HouseholdPvExport
>
selectExportList
(
HouseholdPvDto
dto
,
List
<
Long
>
ids
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/HouseholdPvController.java
View file @
73756915
...
...
@@ -164,85 +164,16 @@ public class HouseholdPvController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"基础数据导入"
,
notes
=
"基础数据导入"
)
public
CommonResponse
importData
(
@RequestPart
(
"file"
)
MultipartFile
multipartFile
)
throws
Exception
{
CommonResponse
commonResponse
=
new
CommonResponse
();
try
{
List
<
HouseholdPvImport
>
list
=
ExcelUtil
.
readFirstSheetExcel
(
multipartFile
,
HouseholdPvImport
.
class
,
2
);
String
check
=
checkData
(
list
);
if
(!
"ok"
.
equals
(
check
)){
return
CommonResponseUtil
.
failure
(
check
);
}
iHouseholdPvService
.
importData
(
list
);
commonResponse
=
iHouseholdPvService
.
importData
(
list
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
CommonResponseUtil
.
success
()
;
return
commonResponse
;
}
private
String
checkData
(
List
<
HouseholdPvImport
>
list
)
{
int
line
=
3
;
Map
<
String
,
Object
>
map
=
householdPvServiceImpl
.
companyNameList
();
for
(
HouseholdPvImport
dto
:
list
)
{
if
(
ObjectUtils
.
isEmpty
(
dto
.
getPlatformCompanyId
()))
{
return
"第 "
+
line
+
" 行所属厂站不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getDistrictId
()))
{
return
"第 "
+
line
+
" 行乡镇不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getNumber
()))
{
return
"第 "
+
line
+
" 行户号不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getName
()))
{
return
"第 "
+
line
+
" 行户主名称不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getSex
()))
{
return
"第 "
+
line
+
" 行性别不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getIdNumber
()))
{
return
"第 "
+
line
+
" 行身份证号不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getExpiryTime
()))
{
return
"第 "
+
line
+
" 行证件过期时间不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getIssuingAuthority
()))
{
return
"第 "
+
line
+
" 行签发机关不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getResidenceAddress
()))
{
return
"第 "
+
line
+
" 行户籍地址不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getPhone
()))
{
return
"第 "
+
line
+
" 行行手机号码不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getAddress
()))
{
return
"第 "
+
line
+
" 行居住地不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getPostcode
()))
{
return
"第 "
+
line
+
" 行居住地邮编不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getServiceAddress
()))
{
return
"第 "
+
line
+
" 行送达地址不能为空!"
;
}
// 导入文件中数据校验
List
<
HouseholdPvImport
>
collect
=
list
.
stream
().
filter
(
item
->
dto
.
getNumber
().
equals
(
item
.
getNumber
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
collect
)
&&
collect
.
size
()
>=
2
)
{
return
"第"
+
line
+
" 行户号重复!"
;
}
// 户号已存在
LambdaQueryWrapper
<
HouseholdPv
>
lambda
=
new
QueryWrapper
<
HouseholdPv
>().
lambda
();
lambda
.
eq
(
HouseholdPv:
:
getNumber
,
dto
.
getNumber
());
Integer
integer
=
householdPvServiceImpl
.
getBaseMapper
().
selectCount
(
lambda
);
if
(
integer
>
0
)
{
return
"第"
+
line
+
" 行户号已存在!"
;
}
if
(!
map
.
containsKey
(
dto
.
getPlatformCompanyId
()))
{
return
"第"
+
line
+
" 行厂站不存在!"
;
}
if
(!
map
.
containsKey
(
dto
.
getDistrictId
()))
{
return
"第"
+
line
+
" 行乡镇不存在!"
;
}
line
=
line
+
1
;
}
return
"ok"
;
}
@GetMapping
(
value
=
"/exportData"
)
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/HouseholdPvDistrictController.java
View file @
73756915
...
...
@@ -159,7 +159,7 @@ public class HouseholdPvDistrictController extends BaseController {
String
name
=
dto
.
get
(
"name"
).
toString
();
LambdaQueryWrapper
<
HouseholdPvDistrict
>
lambda
=
new
QueryWrapper
<
HouseholdPvDistrict
>().
lambda
();
lambda
.
eq
(
HouseholdPvDistrict
::
getName
,
name
);
lambda
.
eq
(
HouseholdPvDistrict:
:
getParentId
,
id
);
//
lambda.eq(HouseholdPvDistrict::getParentId, id);
Integer
integer
=
householdPvDistrictService
.
getBaseMapper
().
selectCount
(
lambda
);
if
(
integer
>
0
){
return
CommonResponseUtil
.
failure
(
"节点已存在!"
);
...
...
@@ -179,10 +179,10 @@ public class HouseholdPvDistrictController extends BaseController {
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
.
getBaseMapper
().
selectById
(
id
);
//
HouseholdPvDistrict householdPvDistrict = householdPvDistrictService.getBaseMapper().selectById(id);
LambdaQueryWrapper
<
HouseholdPvDistrict
>
lambda
=
new
QueryWrapper
<
HouseholdPvDistrict
>().
lambda
();
lambda
.
eq
(
HouseholdPvDistrict
::
getName
,
name
);
lambda
.
eq
(
HouseholdPvDistrict:
:
getParentId
,
householdPvDistrict
.
getParentId
());
//
lambda.eq(HouseholdPvDistrict::getParentId, householdPvDistrict.getParentId());
lambda
.
ne
(
HouseholdPvDistrict
::
getSequenceNbr
,
id
);
Integer
integer
=
householdPvDistrictService
.
getBaseMapper
().
selectCount
(
lambda
);
if
(
integer
>
0
){
...
...
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 @
73756915
...
...
@@ -20,6 +20,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.service.IHouseholdPvContactService
import
com.yeejoin.amos.boot.module.jxiop.api.service.IHouseholdPvInstallService
;
import
com.yeejoin.amos.boot.module.jxiop.api.service.IHouseholdPvLeaseService
;
import
com.yeejoin.amos.boot.module.jxiop.api.service.IHouseholdPvService
;
import
com.yeejoin.amos.boot.module.jxiop.api.util.CommonResponse
;
import
com.yeejoin.amos.boot.module.jxiop.api.util.CommonResponseUtil
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
...
...
@@ -35,6 +36,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 户用光伏表服务实现类
...
...
@@ -124,10 +126,89 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
return
this
.
queryForList
(
""
,
false
);
}
private
String
checkData
(
List
<
HouseholdPvImport
>
list
,
Map
<
String
,
Object
>
map
)
{
int
line
=
3
;
Map
<
String
,
Object
>
orgCodeMap
=
companyOrgCodeList
();
for
(
HouseholdPvImport
dto
:
list
)
{
if
(
ObjectUtils
.
isEmpty
(
dto
.
getPlatformCompanyId
()))
{
return
"第 "
+
line
+
" 行所属厂站不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getDistrictId
()))
{
return
"第 "
+
line
+
" 行乡镇不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getNumber
()))
{
return
"第 "
+
line
+
" 行户号不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getName
()))
{
return
"第 "
+
line
+
" 行户主名称不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getSex
()))
{
return
"第 "
+
line
+
" 行性别不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getIdNumber
()))
{
return
"第 "
+
line
+
" 行身份证号不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getExpiryTime
()))
{
return
"第 "
+
line
+
" 行证件过期时间不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getIssuingAuthority
()))
{
return
"第 "
+
line
+
" 行签发机关不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getResidenceAddress
()))
{
return
"第 "
+
line
+
" 行户籍地址不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getPhone
()))
{
return
"第 "
+
line
+
" 行行手机号码不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getAddress
()))
{
return
"第 "
+
line
+
" 行居住地不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getPostcode
()))
{
return
"第 "
+
line
+
" 行居住地邮编不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getServiceAddress
()))
{
return
"第 "
+
line
+
" 行送达地址不能为空!"
;
}
// 导入文件中数据校验
List
<
HouseholdPvImport
>
collect
=
list
.
stream
().
filter
(
item
->
dto
.
getNumber
().
equals
(
item
.
getNumber
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
collect
)
&&
collect
.
size
()
>=
2
)
{
return
"第"
+
line
+
" 行户号重复!"
;
}
// 户号已存在
LambdaQueryWrapper
<
HouseholdPv
>
lambda
=
new
QueryWrapper
<
HouseholdPv
>().
lambda
();
lambda
.
eq
(
HouseholdPv:
:
getNumber
,
dto
.
getNumber
());
Integer
integer
=
this
.
getBaseMapper
().
selectCount
(
lambda
);
if
(
integer
>
0
)
{
return
"第"
+
line
+
" 行户号已存在!"
;
}
if
(!
map
.
containsKey
(
dto
.
getPlatformCompanyId
()))
{
return
"第"
+
line
+
" 行场站不存在!"
;
}
if
(!
map
.
containsKey
(
dto
.
getDistrictId
()))
{
return
"第"
+
line
+
" 行乡镇不存在!"
;
}
LambdaQueryWrapper
<
HouseholdPvDistrict
>
orgLambda
=
new
QueryWrapper
<
HouseholdPvDistrict
>().
lambda
();
orgLambda
.
likeRight
(
HouseholdPvDistrict:
:
getBizOrgCode
,
orgCodeMap
.
get
(
dto
.
getPlatformCompanyId
()));
List
<
HouseholdPvDistrict
>
householdPvDistricts
=
householdPvDistrictMapper
.
selectList
(
orgLambda
);
List
<
HouseholdPvDistrict
>
townshipList
=
householdPvDistricts
.
stream
().
filter
(
item
->
dto
.
getDistrictId
().
equals
(
item
.
getName
())).
collect
(
Collectors
.
toList
());
if
(
ObjectUtils
.
isEmpty
(
townshipList
))
{
return
"第"
+
line
+
" 行乡镇不属于该场站!"
;
}
line
=
line
+
1
;
}
return
"ok"
;
}
@Override
public
void
importData
(
List
<
HouseholdPvImport
>
list
)
{
public
CommonResponse
importData
(
List
<
HouseholdPvImport
>
list
)
{
ArrayList
<
HouseholdPv
>
householdPvs
=
new
ArrayList
<>();
Map
<
String
,
Object
>
map
=
companyNameList
();
String
checkData
=
checkData
(
list
,
map
);
if
(!
"ok"
.
equals
(
checkData
)){
return
CommonResponseUtil
.
failure
(
checkData
);
}
list
.
forEach
(
item
->
{
HouseholdPv
householdPv
=
new
HouseholdPv
();
BeanUtils
.
copyProperties
(
item
,
householdPv
,
"platformCompanyId"
,
"expiryTime"
,
"districtId"
);
...
...
@@ -158,6 +239,7 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
householdPvs
.
add
(
householdPv
);
});
this
.
saveBatch
(
householdPvs
);
return
CommonResponseUtil
.
success
();
}
public
Map
<
String
,
Object
>
companyNameList
()
{
...
...
@@ -176,6 +258,27 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
return
map
;
}
public
Map
<
String
,
Object
>
companyOrgCodeList
()
{
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
);
if
(
collectionFeignClientResult
!=
null
)
{
Collection
<
UserOrgTreeModel
>
result
=
collectionFeignClientResult
.
getResult
();
changeOrgCode
(
result
,
map
);
}
return
map
;
}
private
void
changeOrgCode
(
Collection
<
UserOrgTreeModel
>
data
,
Map
<
String
,
Object
>
result
)
{
data
.
forEach
(
item
->
{
result
.
put
(
item
.
getName
(),
item
.
getOrgCode
());
if
(!
ObjectUtils
.
isEmpty
(
item
.
getChildren
()))
{
changeOrgCode
(
item
.
getChildren
(),
result
);
}
});
}
private
void
changeName
(
Collection
<
UserOrgTreeModel
>
data
,
Map
<
String
,
Object
>
result
)
{
data
.
forEach
(
item
->
{
result
.
put
(
item
.
getName
(),
item
.
getId
());
...
...
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