Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
3d3f63c5
Commit
3d3f63c5
authored
Apr 27, 2023
by
翁国栋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传模板
parent
a6e13fa8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletions
+30
-1
src/main/java/cn/timer/api/controller/insure/InsureProductController.java
+27
-0
src/main/java/cn/timer/api/dto/insure/PolicyDto.java
+1
-0
src/main/resources/mapping/insure/InsurePolicyMapper.xml
+2
-1
No files found.
src/main/java/cn/timer/api/controller/insure/InsureProductController.java
View file @
3d3f63c5
package
cn
.
timer
.
api
.
controller
.
insure
;
package
cn
.
timer
.
api
.
controller
.
insure
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -10,6 +12,7 @@ import cn.timer.api.dto.insure.PolicyDto;
...
@@ -10,6 +12,7 @@ import cn.timer.api.dto.insure.PolicyDto;
import
cn.timer.api.dto.insure.ProductDto
;
import
cn.timer.api.dto.insure.ProductDto
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.ResultUtil
;
import
cn.timer.api.utils.ResultUtil
;
import
cn.timer.api.utils.aliyun.OSSUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.beust.jcommander.internal.Lists
;
import
com.beust.jcommander.internal.Lists
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
...
@@ -18,6 +21,7 @@ import io.swagger.annotations.ApiOperation;
...
@@ -18,6 +21,7 @@ import io.swagger.annotations.ApiOperation;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
/**
/**
...
@@ -34,6 +38,8 @@ import org.springframework.web.bind.annotation.*;
...
@@ -34,6 +38,8 @@ import org.springframework.web.bind.annotation.*;
public
class
InsureProductController
{
public
class
InsureProductController
{
@Autowired
@Autowired
private
InsureProductMapper
insureProductMapper
;
private
InsureProductMapper
insureProductMapper
;
@Autowired
private
OSSUtil
oss
;
@GetMapping
(
value
=
"/productList"
)
@GetMapping
(
value
=
"/productList"
)
@ApiOperation
(
value
=
"12.产品列表"
,
httpMethod
=
"GET"
,
notes
=
"产品列表"
)
@ApiOperation
(
value
=
"12.产品列表"
,
httpMethod
=
"GET"
,
notes
=
"产品列表"
)
...
@@ -51,5 +57,26 @@ public class InsureProductController {
...
@@ -51,5 +57,26 @@ public class InsureProductController {
}
}
return
ResultUtil
.
error
(
"添加产品失败"
);
return
ResultUtil
.
error
(
"添加产品失败"
);
}
}
@PostMapping
(
value
=
"/importTmp"
)
@ApiOperation
(
value
=
"导入模板"
,
httpMethod
=
"POST"
,
notes
=
"保存产品"
)
public
Result
<
Object
>
saveProduct
(
@RequestParam
(
"productId"
)
Integer
productId
,
@RequestParam
(
"file"
)
MultipartFile
file
)
{
InsureProduct
insureProduct
=
InsureProduct
.
builder
().
id
(
productId
).
build
().
selectById
();
if
(
insureProduct
==
null
){
return
ResultUtil
.
error
(
"导入模板失败"
);
}
String
path
=
"8timer2.0/"
+
productId
+
"/Temp/"
+
file
.
getOriginalFilename
();
if
(
file
==
null
||
file
.
getSize
()
<=
0
)
{
return
ResultUtil
.
error
(
"上传的文件为空,请重新选择!"
);
}
else
{
try
{
String
url
=
oss
.
uploadFile
(
new
File
(
path
),
file
.
getInputStream
());
insureProduct
.
setTmpUrl
(
url
);
insureProduct
.
updateById
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
ResultUtil
.
data
(
path
,
"上传成功!"
);
}
}
}
}
src/main/java/cn/timer/api/dto/insure/PolicyDto.java
View file @
3d3f63c5
...
@@ -50,4 +50,5 @@ public class PolicyDto {
...
@@ -50,4 +50,5 @@ public class PolicyDto {
private
boolean
isAll
=
false
;
private
boolean
isAll
=
false
;
private
Integer
productPlanId
;
private
Integer
productPlanId
;
private
String
planName
;
private
String
planName
;
private
String
tmpUrl
;
}
}
src/main/resources/mapping/insure/InsurePolicyMapper.xml
View file @
3d3f63c5
...
@@ -354,7 +354,8 @@
...
@@ -354,7 +354,8 @@
(select count(org_code) from insure_policy WHERE product_id=ip.id) as totalCompany,
(select count(org_code) from insure_policy WHERE product_id=ip.id) as totalCompany,
count( iu.id ) AS totalUser,
count( iu.id ) AS totalUser,
sum( iu.price ) AS totalPremium,
sum( iu.price ) AS totalPremium,
ipp.update_time AS updateTime
ipp.update_time AS updateTime,
ip.tmp_url as tmpUrl
FROM
FROM
insure_product ip
insure_product ip
LEFT JOIN insure_policy ipp ON ipp.product_id = ip.id and ipp.`status`=1
LEFT JOIN insure_policy ipp ON ipp.product_id = ip.id and ipp.`status`=1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment