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
aa5e8553
Commit
aa5e8553
authored
Mar 29, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
parent
707bd684
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
271 additions
and
51 deletions
+271
-51
EquipType.java
...om/yeejoin/amos/boot/module/jxiop/api/Enum/EquipType.java
+22
-0
LevelType.java
...om/yeejoin/amos/boot/module/jxiop/api/Enum/LevelType.java
+18
-0
HouseholdPvDto.java
...eejoin/amos/boot/module/jxiop/api/dto/HouseholdPvDto.java
+5
-0
HouseholdPvMapper.java
.../amos/boot/module/jxiop/api/mapper/HouseholdPvMapper.java
+3
-0
HouseholdPvDistrictMapper.xml
...i/src/main/resources/mapper/HouseholdPvDistrictMapper.xml
+8
-2
HouseholdPvMapper.xml
...jxiop-api/src/main/resources/mapper/HouseholdPvMapper.xml
+17
-2
HouseholdPvController.java
...ot/module/jxiop/biz/controller/HouseholdPvController.java
+85
-15
HouseholdPvDeviceController.java
...ule/jxiop/biz/controller/HouseholdPvDeviceController.java
+45
-3
HouseholdPvDistrictController.java
...e/jxiop/biz/controller/HouseholdPvDistrictController.java
+25
-11
HouseholdPvDeviceServiceImpl.java
.../jxiop/biz/service/impl/HouseholdPvDeviceServiceImpl.java
+13
-0
HouseholdPvDistrictServiceImpl.java
...xiop/biz/service/impl/HouseholdPvDistrictServiceImpl.java
+1
-14
HouseholdPvServiceImpl.java
...module/jxiop/biz/service/impl/HouseholdPvServiceImpl.java
+27
-4
pom.xml
pom.xml
+2
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/Enum/EquipType.java
0 → 100644
View file @
aa5e8553
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
Enum
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
@Getter
@AllArgsConstructor
public
enum
EquipType
{
INVERTER
(
""
,
"逆变器"
),
SUBASSEMBLY
(
""
,
"组件"
),
DISTRIBUTION_BOX
(
""
,
"配电箱"
),
COMBINER_BOX
(
""
,
"汇流箱"
),
AMMETER
(
""
,
"电表"
),
OTHER
(
""
,
"其他"
);
String
code
;
String
name
;
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/Enum/LevelType.java
0 → 100644
View file @
aa5e8553
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
Enum
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
@Getter
@AllArgsConstructor
public
enum
LevelType
{
NORMAL
(
""
,
"正常"
),
ALARM
(
""
,
"告警"
);
String
code
;
String
name
;
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/dto/HouseholdPvDto.java
View file @
aa5e8553
...
...
@@ -110,4 +110,9 @@ public class HouseholdPvDto extends BaseDto {
* 安装地址
*/
private
String
installAddress
;
/**
* 图片
*/
private
String
img
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/mapper/HouseholdPvMapper.java
View file @
aa5e8553
...
...
@@ -4,6 +4,7 @@ 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
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.CommonFile
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPv
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -24,4 +25,6 @@ public interface HouseholdPvMapper extends BaseMapper<HouseholdPv> {
Page
<
HouseholdPvDto
>
selectPageMessage
(
@Param
(
"page"
)
Page
<
HouseholdPvDto
>
page
,
@Param
(
"dto"
)
HouseholdPvDto
dto
);
String
selectImg
(
@Param
(
"id"
)
Long
id
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/resources/mapper/HouseholdPvDistrictMapper.xml
View file @
aa5e8553
...
...
@@ -36,7 +36,13 @@
FROM
household_pv_district hpd
WHERE
hpd.is_delete = 0 and hpd.sequence_nbr != #{parentId}
AND hpd.biz_org_code LIKE CONCAT(#{bizOrgCode}, '%' )
hpd.is_delete = 0
<if
test=
"parentId != null and parentId != ''"
>
AND hpd.sequence_nbr != #{parentId}
</if>
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND hpd.biz_org_code LIKE CONCAT(#{bizOrgCode}, '%' )
</if>
</select>
</mapper>
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/resources/mapper/HouseholdPvMapper.xml
View file @
aa5e8553
...
...
@@ -41,8 +41,11 @@
<if
test=
"dto.name != null and dto.name != ''"
>
and hp.name like concat('%',#{dto.name},'%')
</if>
<if
test=
"dto.platformCompanyId != null and dto.platformCompanyId != ''"
>
and hp.platform_company_id = #{dto.platformCompanyId}
<if
test=
"dto.bizOrgCode != null and dto.bizOrgCode != ''"
>
and hp.biz_org_code like concat('%',#{dto.bizOrgCode},'%')
</if>
<if
test=
"dto.level != null and dto.level != ''"
>
and hp.level = #{dto.level}
</if>
<if
test=
"dto.residenceAddress != null and dto.residenceAddress != ''"
>
and hp.residence_address like concat('%',#{residenceAddress},'%')
...
...
@@ -74,6 +77,9 @@
<if
test=
"dto.number != null and dto.number != ''"
>
and hp.number like concat('%',#{dto.number},'%')
</if>
<if
test=
"dto.level != null and dto.level != ''"
>
and hp.level = #{dto.level}
</if>
<if
test=
"dto.bizOrgCode != null and dto.bizOrgCode != ''"
>
and hp.biz_org_code like concat('%',#{dto.bizOrgCode},'%')
</if>
...
...
@@ -81,4 +87,13 @@
order by hp.rec_date desc
</select>
<select
id=
"selectImg"
resultType=
"java.lang.String"
>
SELECT
homepage_photo AS img
FROM
household_pv
WHERE
sequence_nbr = #{id}
</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 @
aa5e8553
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
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.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
...
...
@@ -10,6 +12,8 @@ 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.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.boot.module.jxiop.api.util.FileUtil
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.HouseholdPvServiceImpl
;
import
io.swagger.annotations.Api
;
...
...
@@ -34,6 +38,8 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.*
;
import
java.net.URLEncoder
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* 户用光伏表
...
...
@@ -60,16 +66,13 @@ public class HouseholdPvController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增户用光伏表"
,
notes
=
"新增户用光伏表"
)
public
ResponseModel
<
HouseholdPvDto
>
save
(
@RequestBody
HouseholdPvDto
model
)
{
public
CommonResponse
save
(
@RequestBody
HouseholdPvDto
model
)
{
Integer
count
=
householdPvServiceImpl
.
countRepeat
(
model
,
"add"
);
if
(
count
>
0
){
ResponseModel
<
HouseholdPvDto
>
result
=
new
ResponseModel
<>();
result
.
setStatus
(
500
);
result
.
setMessage
(
"户号已经存在"
);
return
result
;
return
CommonResponseUtil
.
failure
(
"户号已经存在"
);
}
model
=
householdPvServiceImpl
.
save
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
return
CommonResponseUtil
.
success
(
model
);
}
/**
...
...
@@ -81,16 +84,13 @@ public class HouseholdPvController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新户用光伏表"
,
notes
=
"根据sequenceNbr更新户用光伏表"
)
public
ResponseModel
<
HouseholdPvDto
>
updateBySequenceNbrHouseholdPv
(
@RequestBody
HouseholdPvDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
public
CommonResponse
updateBySequenceNbrHouseholdPv
(
@RequestBody
HouseholdPvDto
model
,
@PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
model
.
setSequenceNbr
(
sequenceNbr
);
Integer
count
=
householdPvServiceImpl
.
countRepeat
(
model
,
"upd"
);
if
(
count
>
0
){
ResponseModel
<
HouseholdPvDto
>
result
=
new
ResponseModel
<>();
result
.
setStatus
(
500
);
result
.
setMessage
(
"户号已经存在"
);
return
result
;
return
CommonResponseUtil
.
failure
(
"户号已经存在"
);
}
return
ResponseHelper
.
buildResponse
(
householdPvServiceImpl
.
update
(
model
));
return
CommonResponseUtil
.
success
(
householdPvServiceImpl
.
update
(
model
));
}
/**
...
...
@@ -162,15 +162,85 @@ public class HouseholdPvController extends BaseController {
@PostMapping
(
value
=
"/importData"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"基础数据导入"
,
notes
=
"基础数据导入"
)
public
ResponseModel
<
Object
>
importData
(
@RequestPart
(
"file"
)
MultipartFile
multipartFile
)
throws
Exception
{
public
CommonResponse
importData
(
@RequestPart
(
"file"
)
MultipartFile
multipartFile
)
throws
Exception
{
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
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
throw
new
BadRequest
(
e
.
getMessage
());
}
return
ResponseHelper
.
buildResponse
(
"ok"
);
return
CommonResponseUtil
.
success
();
}
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"
;
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/HouseholdPvDeviceController.java
View file @
aa5e8553
...
...
@@ -6,7 +6,11 @@ import javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.module.jxiop.api.Enum.EquipType
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.HouseholdPvDevice
;
import
com.yeejoin.amos.boot.module.jxiop.api.util.CommonResponse
;
import
com.yeejoin.amos.boot.module.jxiop.api.util.CommonResponseUtil
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -142,15 +146,53 @@ public class HouseholdPvDeviceController extends BaseController {
@PostMapping
(
value
=
"/import"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"导入"
,
notes
=
"导入"
)
public
ResponseModel
<
Object
>
importData
(
@RequestPart
(
"file"
)
MultipartFile
multipartFile
,
@RequestParam
(
value
=
"householdPvId"
,
required
=
true
)
String
householdPvId
)
{
public
CommonResponse
importData
(
@RequestPart
(
"file"
)
MultipartFile
multipartFile
,
@RequestParam
(
value
=
"householdPvId"
,
required
=
true
)
String
householdPvId
)
{
List
<
HouseholdPvDeviceImport
>
list
;
try
{
list
=
ExcelUtil
.
readFirstSheetExcel
(
multipartFile
,
HouseholdPvDeviceImport
.
class
,
2
);
String
checkData
=
checkData
(
list
);
if
(!
"ok"
.
equals
(
checkData
)){
return
CommonResponseUtil
.
failure
(
checkData
);
}
householdPvDeviceServiceImpl
.
importData
(
list
,
Long
.
parseLong
(
householdPvId
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
ResponseHelper
.
buildResponse
(
"success"
);
return
CommonResponseUtil
.
success
(
"success"
);
}
private
String
checkData
(
List
<
HouseholdPvDeviceImport
>
list
)
{
int
line
=
3
;
if
(!
ObjectUtils
.
isEmpty
(
line
))
{
for
(
HouseholdPvDeviceImport
dto
:
list
)
{
if
(
ObjectUtils
.
isEmpty
(
dto
.
getType
()))
{
return
"第"
+
line
+
"行"
+
"设备类型不能为空!"
;
}
if
(
ObjectUtils
.
isEmpty
(
dto
.
getName
()))
{
return
"第"
+
line
+
"行"
+
"设备名称不能为空!"
;
}
if
(!
EquipType
.
OTHER
.
getName
().
equals
(
dto
.
getType
())
&&
ObjectUtils
.
isEmpty
(
dto
.
getBrand
()))
{
return
"第"
+
line
+
"行"
+
"品牌不能为空!"
;
}
if
(!
EquipType
.
OTHER
.
getName
().
equals
(
dto
.
getType
())
&&
ObjectUtils
.
isEmpty
(
dto
.
getSNCode
()))
{
return
"第"
+
line
+
"行"
+
"SN编码不能为空!"
;
}
if
(
EquipType
.
INVERTER
.
getName
().
equals
(
dto
.
getType
())
&&
ObjectUtils
.
isEmpty
(
dto
.
getSerialNumber
()))
{
return
"第"
+
line
+
"行"
+
"序列号不能为空!"
;
}
if
(
EquipType
.
INVERTER
.
getName
().
equals
(
dto
.
getType
())
&&
ObjectUtils
.
isEmpty
(
dto
.
getPower
()))
{
return
"第"
+
line
+
"行"
+
"功率不能为空!"
;
}
if
(
EquipType
.
OTHER
.
getName
().
equals
(
dto
.
getType
())
&&
!
EquipType
.
OTHER
.
getName
().
equals
(
dto
.
getName
()))
{
return
"第"
+
line
+
"行"
+
"其他类型下设备名称为:其他!"
;
}
if
(
EquipType
.
OTHER
.
getName
().
equals
(
dto
.
getType
())
&&
ObjectUtils
.
isEmpty
(
dto
.
getDescription
()))
{
return
"第"
+
line
+
"行"
+
"描述不能为空!"
;
}
line
=
line
+
1
;
}
}
return
"ok"
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/HouseholdPvDistrictController.java
View file @
aa5e8553
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
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.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.api.util.CommonResponse
;
import
com.yeejoin.amos.boot.module.jxiop.api.util.CommonResponseUtil
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.HouseholdPvDistrictServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -14,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
...
@@ -143,12 +148,17 @@ public class HouseholdPvDistrictController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/treeAdd"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"树节点新增"
,
notes
=
"树节点新增"
)
public
ResponseModel
<
HouseholdPvDistrict
>
treeAdd
(
@RequestBody
JSONObject
model
)
{
public
CommonResponse
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
);
LambdaQueryWrapper
<
HouseholdPvDistrict
>
lambda
=
new
QueryWrapper
<
HouseholdPvDistrict
>().
lambda
();
lambda
.
eq
(
HouseholdPvDistrict
::
getName
,
name
);
Integer
integer
=
householdPvDistrictService
.
getBaseMapper
().
selectCount
(
lambda
);
if
(
integer
>
0
){
return
CommonResponseUtil
.
failure
(
"节点已存在!"
);
}
return
CommonResponseUtil
.
success
(
householdPvDistrictService
.
treeAdd
(
Long
.
parseLong
(
id
),
name
));
}
/**
...
...
@@ -159,12 +169,18 @@ public class HouseholdPvDistrictController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/treeUpdate"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"树节点新增"
,
notes
=
"树节点新增"
)
public
ResponseModel
<
HouseholdPvDistrict
>
treeUpdate
(
@RequestBody
JSONObject
model
)
{
public
CommonResponse
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
);
LambdaQueryWrapper
<
HouseholdPvDistrict
>
lambda
=
new
QueryWrapper
<
HouseholdPvDistrict
>().
lambda
();
lambda
.
eq
(
HouseholdPvDistrict
::
getName
,
name
);
lambda
.
ne
(
HouseholdPvDistrict
::
getSequenceNbr
,
id
);
Integer
integer
=
householdPvDistrictService
.
getBaseMapper
().
selectCount
(
lambda
);
if
(
integer
>
0
){
return
CommonResponseUtil
.
failure
(
"节点已存在!"
);
}
return
CommonResponseUtil
.
success
(
householdPvDistrictService
.
treeUpdate
(
Long
.
parseLong
(
id
),
name
));
}
/**
* 树节点删除
...
...
@@ -174,14 +190,12 @@ public class HouseholdPvDistrictController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/treeNodesRemove"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"树节点删除"
,
notes
=
"树节点删除"
)
public
ResponseModel
<
Object
>
treeNodesRemove
(
@RequestParam
(
"id"
)
String
id
)
{
public
CommonResponse
treeNodesRemove
(
@RequestParam
(
"id"
)
String
id
)
{
ResponseModel
<
Object
>
model
=
new
ResponseModel
<>();
String
result
=
householdPvDistrictService
.
treeNodesRemove
(
Long
.
parseLong
(
id
));
if
(!
"ok"
.
equals
(
result
))
{
model
.
setStatus
(
500
);
model
.
setMessage
(
result
);
return
model
;
return
CommonResponseUtil
.
failure
(
result
);
}
return
ResponseHelper
.
buildResponse
(
result
);
return
CommonResponseUtil
.
success
(
result
);
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/HouseholdPvDeviceServiceImpl.java
View file @
aa5e8553
...
...
@@ -8,6 +8,7 @@ import javax.servlet.http.HttpServletResponse;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.module.jxiop.api.Enum.EquipType
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -64,8 +65,19 @@ public class HouseholdPvDeviceServiceImpl
HouseholdPvDevice
householdPvDevice
=
new
HouseholdPvDevice
();
BeanUtils
.
copyProperties
(
householdPvDeviceImport
,
householdPvDevice
);
householdPvDevice
.
setHouseholdPvId
(
householdPvId
);
// 其他类型特殊处理
if
(
EquipType
.
OTHER
.
getName
().
equals
(
householdPvDeviceImport
.
getType
())){
householdPvDevice
.
setName
(
null
);
householdPvDevice
.
setBrand
(
null
);
householdPvDevice
.
setSNCode
(
null
);
}
dataList
.
add
(
householdPvDevice
);
}
this
.
baseMapper
.
insertAndUpdate
(
dataList
);
LambdaQueryWrapper
<
HouseholdPvDevice
>
lambda
=
new
QueryWrapper
<
HouseholdPvDevice
>().
lambda
();
lambda
.
eq
(
HouseholdPvDevice:
:
getType
,
EquipType
.
OTHER
.
getName
());
HouseholdPvDevice
householdPvDevice
=
new
HouseholdPvDevice
();
householdPvDevice
.
setName
(
"其他"
);
baseMapper
.
update
(
householdPvDevice
,
lambda
);
}
}
\ No newline at end of file
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 @
aa5e8553
...
...
@@ -64,12 +64,6 @@ public class HouseholdPvDistrictServiceImpl extends BaseService<HouseholdPvDistr
@Override
public
HouseholdPvDistrict
treeAdd
(
Long
parentId
,
String
name
)
{
LambdaQueryWrapper
<
HouseholdPvDistrict
>
lambda
=
new
QueryWrapper
<
HouseholdPvDistrict
>().
lambda
();
lambda
.
eq
(
HouseholdPvDistrict
::
getName
,
name
);
Integer
integer
=
householdPvDistrictMapper
.
selectCount
(
lambda
);
if
(
integer
>
0
){
throw
new
BadRequest
(
"名称重复!"
);
}
String
random
=
""
+
Math
.
random
();
String
substring
=
random
.
substring
(
random
.
length
()
-
4
);
HouseholdPvDistrict
householdPvDistrict
=
new
HouseholdPvDistrict
();
...
...
@@ -92,13 +86,6 @@ public class HouseholdPvDistrictServiceImpl extends BaseService<HouseholdPvDistr
@Override
public
HouseholdPvDistrict
treeUpdate
(
Long
id
,
String
name
)
{
LambdaQueryWrapper
<
HouseholdPvDistrict
>
lambda
=
new
QueryWrapper
<
HouseholdPvDistrict
>().
lambda
();
lambda
.
eq
(
HouseholdPvDistrict
::
getName
,
name
);
lambda
.
ne
(
HouseholdPvDistrict
::
getSequenceNbr
,
id
);
Integer
integer
=
householdPvDistrictMapper
.
selectCount
(
lambda
);
if
(
integer
>
0
){
throw
new
BadRequest
(
"名称重复!"
);
}
HouseholdPvDistrict
householdPvDistrict
=
new
HouseholdPvDistrict
();
householdPvDistrict
.
setSequenceNbr
(
id
);
householdPvDistrict
.
setName
(
name
);
...
...
@@ -125,7 +112,7 @@ public class HouseholdPvDistrictServiceImpl extends BaseService<HouseholdPvDistr
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
<
CompanyTreeDto
>
list
=
householdPvDistrictMapper
.
getList
ByParentId
(
reginParams
.
getCompany
().
getOrgCode
(),
null
);
if
(
collectionFeignClientResult
!=
null
)
{
Collection
<
UserOrgTreeModel
>
result
=
collectionFeignClientResult
.
getResult
();
change
(
result
,
list
);
...
...
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 @
aa5e8553
...
...
@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
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.Enum.LevelType
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.*
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.*
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.HouseholdPvDistrictMapper
;
...
...
@@ -81,6 +82,14 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
Page
<
HouseholdPvDto
>
householdPvDtoPage
=
householdPvMapper
.
selectPageMessage
(
page
,
dto
);
Map
<
String
,
Object
>
map
=
companyList
();
householdPvDtoPage
.
getRecords
().
forEach
(
data
->
{
String
commonFiles
=
householdPvMapper
.
selectImg
(
data
.
getSequenceNbr
());
if
(!
ObjectUtils
.
isEmpty
(
commonFiles
)){
List
<
CommonFile
>
filesList
=
JSON
.
parseArray
(
commonFiles
,
CommonFile
.
class
);
CommonFile
commonFile
=
filesList
.
get
(
0
);
if
(!
ObjectUtils
.
isEmpty
(
commonFile
)){
data
.
setImg
(
ObjectUtils
.
isEmpty
(
commonFile
.
getUrl
())
?
""
:
commonFile
.
getUrl
());
}
}
data
.
setPlatformCompanyName
(
String
.
valueOf
(
map
.
get
(
data
.
getPlatformCompanyId
().
toString
())));
});
return
householdPvDtoPage
;
...
...
@@ -125,6 +134,8 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
list
.
forEach
(
item
->
{
HouseholdPv
householdPv
=
new
HouseholdPv
();
BeanUtils
.
copyProperties
(
item
,
householdPv
,
"platformCompanyId"
,
"expiryTime"
,
"districtId"
);
// 默认状态为正常
householdPv
.
setLevel
(
LevelType
.
NORMAL
.
getName
());
householdPv
.
setCreateTime
(
LocalDateTime
.
now
().
toDate
());
if
(!
ObjectUtils
.
isEmpty
(
item
.
getExpiryTime
()))
{
try
{
...
...
@@ -152,7 +163,7 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
this
.
saveBatch
(
householdPvs
);
}
p
rivate
Map
<
String
,
Object
>
companyNameList
()
{
p
ublic
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
();
...
...
@@ -179,6 +190,13 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
@Override
public
List
<
HouseholdPvExport
>
selectExportList
(
HouseholdPvDto
dto
,
List
<
Long
>
ids
)
{
String
bizOrgCode
=
null
;
if
(!
ObjectUtils
.
isEmpty
(
dto
.
getPlatformCompanyId
()))
{
bizOrgCode
=
getOrgCode
(
dto
.
getPlatformCompanyId
());
if
(!
ObjectUtils
.
isEmpty
(
bizOrgCode
))
{
dto
.
setBizOrgCode
(
bizOrgCode
);
}
}
Map
<
String
,
Object
>
companyMap
=
companyList
();
List
<
HouseholdPvExport
>
householdPvExports
=
householdPvMapper
.
selectExportList
(
dto
,
ids
);
householdPvExports
.
forEach
(
item
->
{
...
...
@@ -269,6 +287,8 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
public
HouseholdPvDto
save
(
HouseholdPvDto
householdPvDto
)
{
HouseholdPv
householdPv
=
new
HouseholdPv
();
BeanUtils
.
copyProperties
(
householdPvDto
,
householdPv
);
// 默认状态为正常
householdPv
.
setLevel
(
LevelType
.
NORMAL
.
getName
());
householdPv
.
setBizOrgCode
(
getOrgCode
(
householdPv
.
getPlatformCompanyId
()));
this
.
save
(
householdPv
);
...
...
@@ -299,17 +319,20 @@ public class HouseholdPvServiceImpl extends BaseService<HouseholdPvDto, Househol
HouseholdPvContact
householdPvContact
=
new
HouseholdPvContact
();
BeanUtils
.
copyProperties
(
householdPvDto
.
getContactInfo
(),
householdPvContact
);
iHouseholdPvContactService
.
update
(
householdPvContact
,
new
LambdaQueryWrapper
<
HouseholdPvContact
>()
householdPvContact
.
setHouseholdPvId
(
householdPv
.
getSequenceNbr
());
iHouseholdPvContactService
.
saveOrUpdate
(
householdPvContact
,
new
LambdaQueryWrapper
<
HouseholdPvContact
>()
.
eq
(
HouseholdPvContact:
:
getHouseholdPvId
,
householdPvDto
.
getSequenceNbr
()));
HouseholdPvLease
householdPvLease
=
new
HouseholdPvLease
();
BeanUtils
.
copyProperties
(
householdPvDto
.
getLeaseInfo
(),
householdPvLease
);
iHouseholdPvLeaseService
.
update
(
householdPvLease
,
new
LambdaQueryWrapper
<
HouseholdPvLease
>()
householdPvLease
.
setHouseholdPvId
(
householdPv
.
getSequenceNbr
());
iHouseholdPvLeaseService
.
saveOrUpdate
(
householdPvLease
,
new
LambdaQueryWrapper
<
HouseholdPvLease
>()
.
eq
(
HouseholdPvLease:
:
getHouseholdPvId
,
householdPvDto
.
getSequenceNbr
()));
HouseholdPvInstall
householdPvInstall
=
new
HouseholdPvInstall
();
BeanUtils
.
copyProperties
(
householdPvDto
.
getInstallInfo
(),
householdPvInstall
);
iHouseholdPvInstallService
.
update
(
householdPvInstall
,
new
LambdaQueryWrapper
<
HouseholdPvInstall
>()
householdPvInstall
.
setHouseholdPvId
(
householdPv
.
getSequenceNbr
());
iHouseholdPvInstallService
.
saveOrUpdate
(
householdPvInstall
,
new
LambdaQueryWrapper
<
HouseholdPvInstall
>()
.
eq
(
HouseholdPvInstall:
:
getHouseholdPvId
,
householdPvDto
.
getSequenceNbr
()));
return
householdPvDto
;
...
...
pom.xml
View file @
aa5e8553
...
...
@@ -337,5 +337,6 @@
<module>
amos-boot-system-tdc
</module>
<module>
amos-boot-system-kgd
</module>
<module>
amos-boot-system-file
</module>
<module>
amos-boot-system-jxiop
</module>
</modules>
</project>
\ 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