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
b79da4f7
Commit
b79da4f7
authored
Oct 17, 2024
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(jg):设备保险信息功能开发
parent
a9b770c0
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
501 additions
and
15 deletions
+501
-15
bean.java.ftl
...oot-biz-common/src/main/resources/template2/bean.java.ftl
+1
-0
controller.java.ftl
...z-common/src/main/resources/template2/controller.java.ftl
+11
-11
serviceImpl.java.ftl
...-common/src/main/resources/template2/serviceImpl.java.ftl
+5
-4
JgEquipInsuranceDto.java
...join/amos/boot/module/jg/api/dto/JgEquipInsuranceDto.java
+70
-0
JgEquipInsurance.java
...join/amos/boot/module/jg/api/entity/JgEquipInsurance.java
+90
-0
JgEquipInsuranceMapper.java
...mos/boot/module/jg/api/mapper/JgEquipInsuranceMapper.java
+27
-0
IJgEquipInsuranceService.java
.../boot/module/jg/api/service/IJgEquipInsuranceService.java
+9
-0
JgEquipInsuranceMapper.xml
...-api/src/main/resources/mapper/JgEquipInsuranceMapper.xml
+64
-0
JgEquipInsuranceController.java
.../module/jg/biz/controller/JgEquipInsuranceController.java
+116
-0
JgEquipInsuranceServiceImpl.java
...dule/jg/biz/service/impl/JgEquipInsuranceServiceImpl.java
+108
-0
No files found.
amos-boot-biz-common/src/main/resources/template2/bean.java.ftl
View file @
b79da4f7
...
@@ -6,6 +6,7 @@ import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
...
@@ -6,6 +6,7 @@ import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import
lombok
.
Data
;
import
lombok
.
Data
;
import
lombok
.
EqualsAndHashCode
;
import
lombok
.
EqualsAndHashCode
;
import
lombok
.
experimental
.
Accessors
;
import
lombok
.
experimental
.
Accessors
;
import
java
.
util
.
Date
;
/**
/**
*
${
table
.
comment
!}
*
${
table
.
comment
!}
...
...
amos-boot-biz-common/src/main/resources/template2/controller.java.ftl
View file @
b79da4f7
...
@@ -19,7 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -19,7 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
javax
.
servlet
.
http
.
HttpServletRequest
;
import
javax
.
servlet
.
http
.
HttpServletRequest
;
import
org
.
springframework
.
web
.
bind
.
annotation
.*;
import
org
.
springframework
.
web
.
bind
.
annotation
.*;
import
com
.
baomidou
.
mybatisplus
.
extension
.
plugins
.
pagination
.
Page
;
import
com
.
baomidou
.
mybatisplus
.
extension
.
plugins
.
pagination
.
Page
;
import
${
package
.
Xml
}.${
entity
}
Model
;
import
${
package
.
Xml
}.${
entity
};
import
org
.
typroject
.
tyboot
.
core
.
restful
.
doc
.
TycloudOperation
;
import
org
.
typroject
.
tyboot
.
core
.
restful
.
doc
.
TycloudOperation
;
import
org
.
typroject
.
tyboot
.
core
.
foundation
.
enumeration
.
UserType
;
import
org
.
typroject
.
tyboot
.
core
.
foundation
.
enumeration
.
UserType
;
...
@@ -55,9 +55,9 @@ public class ${table.controllerName} {
...
@@ -55,9 +55,9 @@ public class ${table.controllerName} {
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
PostMapping
(
value
=
"/save"
)
@
PostMapping
(
value
=
"/save"
)
@
ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增"
,
notes
=
"新增"
)
@
ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增"
,
notes
=
"新增"
)
public
ResponseModel
<${
entity
}
Model
>
save
(@
RequestBody
${
entity
}
Model
model
)
{
public
ResponseModel
<${
entity
}
>
save
(@
RequestBody
${
entity
}
)
{
model
=
${
table
.
serviceImplName
?
uncap_first
}.
createWithModel
(
model
);
entity
=
${
table
.
serviceImplName
?
uncap_first
}.
createWithModel
(
entity
);
return
ResponseHelper
.
buildResponse
(
model
);
return
ResponseHelper
.
buildResponse
(
entity
);
}
}
/**
/**
...
@@ -69,9 +69,9 @@ public class ${table.controllerName} {
...
@@ -69,9 +69,9 @@ public class ${table.controllerName} {
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
PutMapping
(
value
=
"/{sequenceNbr}"
)
@
PutMapping
(
value
=
"/{sequenceNbr}"
)
@
ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新"
,
notes
=
"根据sequenceNbr更新"
)
@
ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新"
,
notes
=
"根据sequenceNbr更新"
)
public
ResponseModel
<${
entity
}
Model
>
updateBySequenceNbr
${
entity
}(@
RequestBody
${
entity
}
Model
model
,@
PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
public
ResponseModel
<${
entity
}
>
updateBySequenceNbr
${
entity
}(@
RequestBody
${
entity
}
entity
,@
PathVariable
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
model
.
setSequenceNbr
(
sequenceNbr
);
entity
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(${
table
.
serviceImplName
?
uncap_first
}.
updateWithModel
(
model
));
return
ResponseHelper
.
buildResponse
(${
table
.
serviceImplName
?
uncap_first
}.
updateWithModel
(
entity
));
}
}
/**
/**
...
@@ -96,7 +96,7 @@ public class ${table.controllerName} {
...
@@ -96,7 +96,7 @@ public class ${table.controllerName} {
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
GetMapping
(
value
=
"/{sequenceNbr}"
)
@
GetMapping
(
value
=
"/{sequenceNbr}"
)
@
ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个"
,
notes
=
"根据sequenceNbr查询单个"
)
@
ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个"
,
notes
=
"根据sequenceNbr查询单个"
)
public
ResponseModel
<${
entity
}
Model
>
selectOne
(@
PathVariable
Long
sequenceNbr
)
{
public
ResponseModel
<${
entity
}>
selectOne
(@
PathVariable
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(${
table
.
serviceImplName
?
uncap_first
}.
queryBySeq
(
sequenceNbr
));
return
ResponseHelper
.
buildResponse
(${
table
.
serviceImplName
?
uncap_first
}.
queryBySeq
(
sequenceNbr
));
}
}
...
@@ -110,9 +110,9 @@ public class ${table.controllerName} {
...
@@ -110,9 +110,9 @@ public class ${table.controllerName} {
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
GetMapping
(
value
=
"/page"
)
@
GetMapping
(
value
=
"/page"
)
@
ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询"
,
notes
=
"分页查询"
)
@
ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询"
,
notes
=
"分页查询"
)
public
ResponseModel
<
Page
<${
entity
}
Model
>>
queryForPage
(@
RequestParam
(
value
=
"current"
)
int
current
,@
RequestParam
public
ResponseModel
<
Page
<${
entity
}>>
queryForPage
(@
RequestParam
(
value
=
"current"
)
int
current
,@
RequestParam
(
value
=
"size"
)
int
size
)
{
(
value
=
"size"
)
int
size
)
{
Page
<${
entity
}
Model
>
page
=
new
Page
<${
entity
}
Model
>();
Page
<${
entity
}
>
page
=
new
Page
<${
entity
}
>();
page
.
setCurrent
(
current
);
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(${
table
.
serviceImplName
?
uncap_first
}.
queryFor
${
entity
}
Page
(
page
));
return
ResponseHelper
.
buildResponse
(${
table
.
serviceImplName
?
uncap_first
}.
queryFor
${
entity
}
Page
(
page
));
...
@@ -126,7 +126,7 @@ public class ${table.controllerName} {
...
@@ -126,7 +126,7 @@ public class ${table.controllerName} {
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表全部数据查询"
,
notes
=
"列表全部数据查询"
)
@
ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表全部数据查询"
,
notes
=
"列表全部数据查询"
)
@
GetMapping
(
value
=
"/list"
)
@
GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<${
entity
}
Model
>>
selectForList
()
{
public
ResponseModel
<
List
<${
entity
}>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(${
table
.
serviceImplName
?
uncap_first
}.
queryFor
${
entity
}
List
());
return
ResponseHelper
.
buildResponse
(${
table
.
serviceImplName
?
uncap_first
}.
queryFor
${
entity
}
List
());
}
}
}
}
...
...
amos-boot-biz-common/src/main/resources/template2/serviceImpl.java.ftl
View file @
b79da4f7
...
@@ -3,7 +3,7 @@ package ${package.ServiceImpl};
...
@@ -3,7 +3,7 @@ package ${package.ServiceImpl};
import
${
package
.
Entity
}.${
entity
};
import
${
package
.
Entity
}.${
entity
};
import
${
package
.
Mapper
}.${
table
.
mapperName
};
import
${
package
.
Mapper
}.${
table
.
mapperName
};
import
${
package
.
Service
}.${
table
.
serviceName
};
import
${
package
.
Service
}.${
table
.
serviceName
};
import
${
package
.
Xml
}.${
entity
}
Model
;
import
${
package
.
Xml
}.${
entity
};
import
org
.
typroject
.
tyboot
.
core
.
rdbms
.
service
.
BaseService
;
import
org
.
typroject
.
tyboot
.
core
.
rdbms
.
service
.
BaseService
;
import
org
.
springframework
.
stereotype
.
Service
;
import
org
.
springframework
.
stereotype
.
Service
;
import
com
.
baomidou
.
mybatisplus
.
extension
.
plugins
.
pagination
.
Page
;
import
com
.
baomidou
.
mybatisplus
.
extension
.
plugins
.
pagination
.
Page
;
...
@@ -16,18 +16,18 @@ import java.util.List;
...
@@ -16,18 +16,18 @@ import java.util.List;
*
@
date
${
date
}
*
@
date
${
date
}
*/
*/
@
Service
@
Service
public
class
${
table
.
serviceImplName
}
extends
BaseService
<${
entity
}
Model
,${
entity
},${
table
.
mapperName
}>
implements
${
table
.
serviceName
}
{
public
class
${
table
.
serviceImplName
}
extends
BaseService
<${
entity
},${
entity
},${
table
.
mapperName
}>
implements
${
table
.
serviceName
}
{
/**
/**
*
分页查询
*
分页查询
*/
*/
public
Page
<${
entity
}
Model
>
queryFor
${
entity
}
Page
(
Page
<${
entity
}
Model
>
page
)
{
public
Page
<${
entity
}
>
queryFor
${
entity
}
Page
(
Page
<${
entity
}
>
page
)
{
return
this
.
queryForPage
(
page
,
null
,
false
);
return
this
.
queryForPage
(
page
,
null
,
false
);
}
}
/**
/**
*
列表查询
示例
*
列表查询
示例
*/
*/
public
List
<${
entity
}
Model
>
queryFor
${
entity
}
List
()
{
public
List
<${
entity
}>
queryFor
${
entity
}
List
()
{
return
this
.
queryForList
(
""
,
false
);
return
this
.
queryForList
(
""
,
false
);
}
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/dto/JgEquipInsuranceDto.java
0 → 100644
View file @
b79da4f7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
* 设备保险信息
*
* @author LiuLin
* @date 2024-10-17
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"JgEquipInsuranceDto"
,
description
=
"设备保险信息"
)
public
class
JgEquipInsuranceDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"设备id"
)
private
String
equId
;
@ApiModelProperty
(
value
=
"承保单位名称"
)
private
String
underWriteName
;
@ApiModelProperty
(
value
=
"承保单位统一信用代码"
)
private
String
underWriteCreditCode
;
@ApiModelProperty
(
value
=
"保险服务单位"
)
private
String
insuranceServiceUnitName
;
@ApiModelProperty
(
value
=
"保险服务单位统一社会信用代码"
)
private
String
insuranceServiceUnitCode
;
@ApiModelProperty
(
value
=
"理赔电话"
)
private
String
claimTelephone
;
@ApiModelProperty
(
value
=
"保险单号"
)
private
String
insuranceNumber
;
@ApiModelProperty
(
value
=
"保险截止日期"
)
private
Date
insuranceExpirationDate
;
@ApiModelProperty
(
value
=
"设备种类"
)
private
String
equList
;
@ApiModelProperty
(
value
=
"设备类别"
)
private
String
equCategory
;
@ApiModelProperty
(
value
=
"设备品种"
)
private
String
equDefine
;
@ApiModelProperty
(
value
=
"登记机关"
)
private
String
receiveOrgName
;
@ApiModelProperty
(
value
=
"使用单位"
)
private
String
useUnitName
;
@ApiModelProperty
(
value
=
"单位内编号"
)
private
String
useInnerCode
;
@ApiModelProperty
(
value
=
"出厂编号"
)
private
String
factoryNum
;
@ApiModelProperty
(
value
=
"使用登记证编号"
)
private
String
useRegistrationCode
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/entity/JgEquipInsurance.java
0 → 100644
View file @
b79da4f7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
/**
* 设备保险信息
*
* @author LiuLin
* @date 2024-10-17
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"tzs_jg_equip_insurance"
)
public
class
JgEquipInsurance
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 设备id
*/
@TableField
(
"equ_id"
)
private
String
equId
;
/**
* 承保单位名称
*/
@TableField
(
"under_write_name"
)
private
String
underWriteName
;
/**
* 承保单位统一信用代码
*/
@TableField
(
"under_write_credit_code"
)
private
String
underWriteCreditCode
;
/**
* 保险服务单位
*/
@TableField
(
"insurance_service_unit_name"
)
private
String
insuranceServiceUnitName
;
/**
* 保险服务单位统一社会信用代码
*/
@TableField
(
"insurance_service_unit_code"
)
private
String
insuranceServiceUnitCode
;
/**
* 理赔电话
*/
@TableField
(
"claim_telephone"
)
private
String
claimTelephone
;
/**
* 保险单号
*/
@TableField
(
"insurance_number"
)
private
String
insuranceNumber
;
/**
* 保险截止日期
*/
@TableField
(
"insurance_expiration_date"
)
private
Date
insuranceExpirationDate
;
/**
* 设备种类
*/
@TableField
(
"equ_list"
)
private
String
equList
;
/**
* 设备类别
*/
@TableField
(
"equ_category"
)
private
String
equCategory
;
/**
* 设备品种
*/
@TableField
(
"equ_define"
)
private
String
equDefine
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/mapper/JgEquipInsuranceMapper.java
0 → 100644
View file @
b79da4f7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
mapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgEquipInsuranceDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgEquipInsurance
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* Mapper 接口
*
* @author LiuLin
* @date 2024-10-17
*/
public
interface
JgEquipInsuranceMapper
extends
BaseMapper
<
JgEquipInsurance
>
{
Page
<
JgEquipInsuranceDto
>
getListPage
(
@Param
(
"page"
)
Page
<
JgEquipInsurance
>
page
,
@Param
(
"sort"
)
SortVo
sortMap
,
@Param
(
"dto"
)
JgEquipInsuranceDto
dto
);
JgEquipInsuranceDto
getDetailById
(
@Param
(
"sequenceNbr"
)
Long
sequenceNbr
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/service/IJgEquipInsuranceService.java
0 → 100644
View file @
b79da4f7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
service
;
/**
* 接口类
*
* @author LiuLin
* @date 2024-10-17
*/
public
interface
IJgEquipInsuranceService
{}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgEquipInsuranceMapper.xml
0 → 100644
View file @
b79da4f7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.jg.api.mapper.JgEquipInsuranceMapper"
>
<sql
id=
"page-list"
>
select
tjei.sequence_nbr as sequenceNbr,
tjei.equ_id as equId,
tjei.under_write_name as underWriteName,
tjei.under_write_credit_code as underWriteCreditCode,
tjei.insurance_service_unit_name as insuranceServiceUnitName,
tjei.insurance_service_unit_code as insuranceServiceUnitCode,
tjei.claim_telephone as claimTelephone,
tjei.insurance_number as insuranceNumber,
tjei.insurance_expiration_date as insuranceExpirationDate,
date_format(tjei.rec_date,'%Y-%m-%d') as recDate,
jri.ORGANIZATION_NAME as receiveOrgName,
jri.USE_ORG_CODE as useRegistrationCode,
ibjui.USE_UNIT_NAME as useUnitName,
ibjui.USE_INNER_CODE as useInnerCode,
ibjfi.FACTORY_NUM as factoryNum,
GROUP_CONCAT(DISTINCT (SELECT name from tz_equipment_category where code = jri.EQU_LIST)) AS equList,
GROUP_CONCAT(DISTINCT (SELECT name from tz_equipment_category where code = jri.EQU_CATEGORY)) as equCategory,
GROUP_CONCAT(DISTINCT (SELECT name from tz_equipment_category where code = jri.EQU_DEFINE)) as equDefine
from
tzs_jg_equip_insurance tjei
LEFT JOIN idx_biz_jg_register_info jri on tjei.equ_id = jri.RECORD
LEFT JOIN idx_biz_jg_use_info ibjui on tjei.equ_id = ibjui.RECORD
LEFT JOIN idx_biz_jg_factory_info ibjfi on tjei.equ_id = ibjfi.RECORD
</sql>
<select
id=
"getListPage"
resultType=
"com.yeejoin.amos.boot.module.jg.api.dto.JgEquipInsuranceDto"
>
<include
refid=
"page-list"
/>
<where>
tjei.is_delete = 0
<if
test=
"dto.factoryNum != null and dto.factoryNum != ''"
>
AND ibjfi.FACTORY_NUM = #{dto.factoryNum}
</if>
<if
test=
"dto.useInnerCode != null and dto.useInnerCode != ''"
>
AND ibjui.USE_INNER_CODE = #{dto.useInnerCode}
</if>
<if
test=
"dto.underWriteName != null and dto.underWriteName != ''"
>
AND tjei.under_write_name like concat('%',#{dto.underWriteName},'%')
</if>
<if
test=
"dto.insuranceNumber != null and dto.insuranceNumber != ''"
>
AND tjei.insurance_number like concat('%',#{dto.insuranceNumber},'%')
</if>
<if
test=
"dto.useRegistrationCode != null and dto.useRegistrationCode != ''"
>
AND jri.USE_ORG_CODE like concat('%',#{dto.useRegistrationCode},'%')
</if>
GROUP BY tjei.equ_id
</where>
order by
<if
test=
"sort != null"
>
tjei.${sort.field} ${sort.sortType},
</if>
tjei.rec_date DESC
</select>
<select
id=
"getDetailById"
resultType=
"com.yeejoin.amos.boot.module.jg.api.dto.JgEquipInsuranceDto"
>
<include
refid=
"page-list"
/>
where tjei.sequence_nbr = #{sequenceNbr} and tjei.is_delete = 0
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgEquipInsuranceController.java
0 → 100644
View file @
b79da4f7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgEquipInsuranceDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgEquipInsurance
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgEquipInsuranceServiceImpl
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.util.List
;
/**
* 设备保险信息控制类
* @author LiuLin
* @date 2024-10-17
*/
@RestController
@Api
(
tags
=
"Api"
)
@RequestMapping
(
value
=
"/jg-equip-insurance"
)
public
class
JgEquipInsuranceController
extends
BaseController
{
@Autowired
JgEquipInsuranceServiceImpl
jgEquipInsuranceServiceImpl
;
/**
* 新增
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增"
,
notes
=
"新增"
)
public
ResponseModel
<
Object
>
save
(
@RequestBody
JSONObject
map
)
{
return
ResponseHelper
.
buildResponse
(
jgEquipInsuranceServiceImpl
.
save
(
map
));
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PutMapping
(
value
=
"/update"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新"
,
notes
=
"根据sequenceNbr更新"
)
public
ResponseModel
<
JgEquipInsurance
>
updateBySequenceNbrJgEquipInsurance
(
@RequestBody
JgEquipInsurance
entity
,
@RequestParam
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
)
{
entity
.
setSequenceNbr
(
sequenceNbr
);
return
ResponseHelper
.
buildResponse
(
jgEquipInsuranceServiceImpl
.
updateWithModel
(
entity
));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/delete"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"根据sequenceNbr删除"
,
notes
=
"根据sequenceNbr删除"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbr
(
@RequestParam
(
value
=
"sequenceNbr"
)
Long
sequenceNbr
){
return
ResponseHelper
.
buildResponse
(
jgEquipInsuranceServiceImpl
.
removeById
(
sequenceNbr
));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/getDetail"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据sequenceNbr查询单个"
,
notes
=
"根据sequenceNbr查询单个"
)
public
ResponseModel
<
JgEquipInsuranceDto
>
getDetail
(
@RequestParam
Long
sequenceNbr
)
{
return
ResponseHelper
.
buildResponse
(
jgEquipInsuranceServiceImpl
.
getDetail
(
sequenceNbr
));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"分页查询"
,
notes
=
"分页查询"
)
public
ResponseModel
<
Page
<
JgEquipInsuranceDto
>>
queryForPage
(
@RequestParam
(
value
=
"sort"
,
required
=
false
)
String
sort
,
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
JgEquipInsuranceDto
dto
){
Page
<
JgEquipInsurance
>
page
=
new
Page
<>(
current
,
size
);
return
ResponseHelper
.
buildResponse
(
jgEquipInsuranceServiceImpl
.
queryForJgEquipInsurancePage
(
page
,
sort
,
dto
));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"列表全部数据查询"
,
notes
=
"列表全部数据查询"
)
@GetMapping
(
value
=
"/list"
)
public
ResponseModel
<
List
<
JgEquipInsurance
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
jgEquipInsuranceServiceImpl
.
queryForJgEquipInsuranceList
());
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgEquipInsuranceServiceImpl.java
0 → 100644
View file @
b79da4f7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
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.jg.api.dto.JgEquipInsuranceDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgEquipInsurance
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgEquipInsuranceMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgEquipInsuranceService
;
import
com.yeejoin.amos.boot.module.jg.api.vo.SortVo
;
import
io.swagger.annotations.ApiParam
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* 服务实现类
*
* @author LiuLin
* @date 2024-10-17
*/
@Service
public
class
JgEquipInsuranceServiceImpl
extends
BaseService
<
JgEquipInsurance
,
JgEquipInsurance
,
JgEquipInsuranceMapper
>
implements
IJgEquipInsuranceService
{
@Autowired
private
RedisUtils
redisUtils
;
@Autowired
private
CommonServiceImpl
commonServiceImpl
;
private
static
final
String
SECOND
=
"second"
;
private
static
final
String
DEVICE_LIST
=
"deviceList"
;
/**
* 分页查询
*/
public
Page
<
JgEquipInsuranceDto
>
queryForJgEquipInsurancePage
(
Page
<
JgEquipInsurance
>
page
,
@ApiParam
(
value
=
"排序字段"
)
@RequestParam
(
value
=
"sort"
,
required
=
false
)
String
sort
,
JgEquipInsuranceDto
dto
)
{
SortVo
sortMap
=
commonServiceImpl
.
sortFieldConversion
(
sort
);
return
this
.
baseMapper
.
getListPage
(
page
,
sortMap
,
dto
);
}
/**
* 列表查询 示例
*/
public
List
<
JgEquipInsurance
>
queryForJgEquipInsuranceList
()
{
return
this
.
queryForList
(
""
,
false
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Object
save
(
JSONObject
map
)
{
// 从 Redis 中获取 ReginParams 对象
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
// 解析 secondMap 和设备保险信息
JSONObject
secondMap
=
map
.
getJSONObject
(
"second"
);
JgEquipInsurance
equipInsurance
=
map
.
getObject
(
SECOND
,
JgEquipInsurance
.
class
);
// 获取设备列表并进行校验
List
<
Map
>
deviceList
=
secondMap
.
getJSONArray
(
DEVICE_LIST
).
toJavaList
(
Map
.
class
);
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
throw
new
BadRequest
(
"请选择设备信息!"
);
}
// 使用流创建新的保险对象列表并保存
return
this
.
saveBatch
(
deviceList
.
stream
()
.
map
(
x
->
{
JgEquipInsurance
newInsurance
=
new
JgEquipInsurance
();
BeanUtils
.
copyProperties
(
equipInsurance
,
newInsurance
);
newInsurance
.
setEquId
(
String
.
valueOf
(
x
.
get
(
"record"
)));
newInsurance
.
setEquList
(
String
.
valueOf
(
x
.
get
(
"EQU_LIST_CODE"
)));
newInsurance
.
setEquCategory
(
String
.
valueOf
(
x
.
get
(
"EQU_CATEGORY_CODE"
)));
newInsurance
.
setEquDefine
(
String
.
valueOf
(
x
.
get
(
"EQU_DEFINE_CODE"
)));
newInsurance
.
setRecUserId
(
reginParams
.
getUserModel
().
getUserId
());
newInsurance
.
setRecUserName
(
reginParams
.
getUserModel
().
getUserName
());
newInsurance
.
setRecDate
(
new
Date
());
newInsurance
.
setIsDelete
(
false
);
return
newInsurance
;
})
.
collect
(
Collectors
.
toList
())
);
}
public
JgEquipInsuranceDto
getDetail
(
Long
sequenceNbr
)
{
return
this
.
getBaseMapper
().
getDetailById
(
sequenceNbr
);
}
}
\ 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