Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
research-project
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
hqzhdj
research-project
Commits
c41299d4
Commit
c41299d4
authored
Dec 02, 2024
by
梅存智
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
问卷调查优化
parent
ff7ad697
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
125 additions
and
13 deletions
+125
-13
cloud-research-api/src/main/java/com/yizhi/research/application/feign/ResearchClient.java
+8
-0
cloud-research-api/src/main/java/com/yizhi/research/application/vo/api/PageVo.java
+2
-0
cloud-research-api/src/main/java/com/yizhi/research/application/vo/domain/ResearchVo.java
+4
-2
cloud-research-service/src/main/java/com/yizhi/research/application/SwaggerConfig.java
+2
-2
cloud-research-service/src/main/java/com/yizhi/research/application/controller/ResearchController.java
+10
-0
cloud-research-service/src/main/java/com/yizhi/research/application/mapper/ResearchMapper.java
+10
-2
cloud-research-service/src/main/java/com/yizhi/research/application/mapper/ResearchMapper.xml
+70
-3
cloud-research-service/src/main/java/com/yizhi/research/application/service/IResearchService.java
+7
-0
cloud-research-service/src/main/java/com/yizhi/research/application/service/impl/ResearchServiceImpl.java
+11
-3
cloud-research-service/src/main/java/com/yizhi/research/application/vo/domain/Research.java
+1
-1
No files found.
cloud-research-api/src/main/java/com/yizhi/research/application/feign/ResearchClient.java
View file @
c41299d4
...
@@ -209,6 +209,14 @@ public interface ResearchClient {
...
@@ -209,6 +209,14 @@ public interface ResearchClient {
*/
*/
@GetMapping
(
"/research/info"
)
@GetMapping
(
"/research/info"
)
ResearchVo
viewInfo
(
@RequestParam
(
"id"
)
Long
id
);
ResearchVo
viewInfo
(
@RequestParam
(
"id"
)
Long
id
);
/**
* 获取置顶的调研信息
* @param bizType
* @return
*/
@GetMapping
(
"/research/top/get"
)
List
<
ResearchVo
>
getResearchTop
(
@RequestParam
(
"bizType"
)
Integer
bizType
);
}
}
cloud-research-api/src/main/java/com/yizhi/research/application/vo/api/PageVo.java
View file @
c41299d4
...
@@ -22,4 +22,6 @@ public class PageVo {
...
@@ -22,4 +22,6 @@ public class PageVo {
private
Integer
pageNo
;
private
Integer
pageNo
;
private
Integer
pageSize
;
private
Integer
pageSize
;
private
Integer
bizType
;
}
}
cloud-research-api/src/main/java/com/yizhi/research/application/vo/domain/ResearchVo.java
View file @
c41299d4
...
@@ -207,7 +207,7 @@ public class ResearchVo {
...
@@ -207,7 +207,7 @@ public class ResearchVo {
private
List
<
TrResearchAnswerVo
>
trResearchAnswerVos
;
private
List
<
TrResearchAnswerVo
>
trResearchAnswerVos
;
@ApiModelProperty
(
value
=
"搜索列表显示状态:
1已完成,2进行中,3已过期
"
)
@ApiModelProperty
(
value
=
"搜索列表显示状态:
0未开始,1已完成,2进行中,3已过期,4未参加调研
"
)
private
Integer
finishState
;
private
Integer
finishState
;
...
@@ -232,5 +232,7 @@ public class ResearchVo {
...
@@ -232,5 +232,7 @@ public class ResearchVo {
@ApiModelProperty
(
value
=
"调研logo"
)
@ApiModelProperty
(
value
=
"调研logo"
)
private
String
image
;
private
String
image
;
@ApiModelProperty
(
value
=
"调研logo"
)
private
String
logoImg
;
}
}
cloud-research-service/src/main/java/com/yizhi/research/application/SwaggerConfig.java
View file @
c41299d4
...
@@ -12,10 +12,10 @@ import springfox.documentation.spring.web.plugins.Docket;
...
@@ -12,10 +12,10 @@ import springfox.documentation.spring.web.plugins.Docket;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@Configuration
@Configuration
@EnableSwagger2
//
@EnableSwagger2
public
class
SwaggerConfig
{
public
class
SwaggerConfig
{
@Value
(
"${swagger.enabled}"
)
//
@Value("${swagger.enabled}")
private
boolean
swaggerEnabled
;
private
boolean
swaggerEnabled
;
@Bean
@Bean
public
Docket
createRestApi
()
{
public
Docket
createRestApi
()
{
...
...
cloud-research-service/src/main/java/com/yizhi/research/application/controller/ResearchController.java
View file @
c41299d4
...
@@ -398,5 +398,15 @@ public class ResearchController {
...
@@ -398,5 +398,15 @@ public class ResearchController {
Research
viewInfo
(
@RequestParam
(
"id"
)
Long
id
)
{
Research
viewInfo
(
@RequestParam
(
"id"
)
Long
id
)
{
return
researchService
.
viewInfo
(
id
);
return
researchService
.
viewInfo
(
id
);
}
}
/**
* 获取置顶的调研信息
* @param bizType
* @return
*/
@GetMapping
(
"/top/get"
)
List
<
ResearchVo
>
getResearchTop
(
@RequestParam
(
"bizType"
)
Integer
bizType
){
return
researchService
.
getResearchTop
(
bizType
);
}
}
}
cloud-research-service/src/main/java/com/yizhi/research/application/mapper/ResearchMapper.java
View file @
c41299d4
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.yizhi.research.application.model.DataRangeModel
;
import
com.yizhi.research.application.model.DataRangeModel
;
import
com.yizhi.research.application.vo.domain.Research
;
import
com.yizhi.research.application.vo.domain.Research
;
import
com.yizhi.research.application.vo.domain.ResearchVo
;
import
com.yizhi.research.application.vo.domain.TrResearchAuthorize
;
import
com.yizhi.research.application.vo.domain.TrResearchAuthorize
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
org.apache.ibatis.annotations.Select
;
...
@@ -60,7 +61,7 @@ public interface ResearchMapper extends BaseMapper<Research> {
...
@@ -60,7 +61,7 @@ public interface ResearchMapper extends BaseMapper<Research> {
* @return
* @return
*/
*/
List
<
Research
>
apiListResearch
(
@Param
(
"idsInRange"
)
List
<
Long
>
idsInRange
,
@Param
(
"accountId"
)
Long
accountId
,
List
<
Research
>
apiListResearch
(
@Param
(
"idsInRange"
)
List
<
Long
>
idsInRange
,
@Param
(
"accountId"
)
Long
accountId
,
@Param
(
"siteId"
)
Long
siteId
,
@Param
(
"now"
)
Date
now
,
@Param
(
"state"
)
Integer
state
,
@Param
(
"siteId"
)
Long
siteId
,
@Param
(
"now"
)
Date
now
,
@Param
(
"state"
)
Integer
state
,
@Param
(
"bizType"
)
Integer
bizType
,
RowBounds
rowBounds
);
RowBounds
rowBounds
);
/**
/**
...
@@ -80,7 +81,7 @@ public interface ResearchMapper extends BaseMapper<Research> {
...
@@ -80,7 +81,7 @@ public interface ResearchMapper extends BaseMapper<Research> {
@Param
(
"siteId"
)
Long
siteId
,
@Param
(
"now"
)
Date
now
);
@Param
(
"siteId"
)
Long
siteId
,
@Param
(
"now"
)
Date
now
);
int
selectListCount
(
@Param
(
"idsInRange"
)
List
<
Long
>
idsInRange
,
@Param
(
"accountId"
)
Long
accountId
,
int
selectListCount
(
@Param
(
"idsInRange"
)
List
<
Long
>
idsInRange
,
@Param
(
"accountId"
)
Long
accountId
,
@Param
(
"siteId"
)
Long
siteId
,
@Param
(
"now"
)
Date
now
,
@Param
(
"state"
)
Integer
state
);
@Param
(
"siteId"
)
Long
siteId
,
@Param
(
"now"
)
Date
now
,
@Param
(
"state"
)
Integer
state
,
@Param
(
"bizType"
)
Integer
bizType
);
LinkedList
<
Research
>
selectRealJoin
(
@Param
(
"researchIds"
)
List
<
Long
>
researchIds
);
LinkedList
<
Research
>
selectRealJoin
(
@Param
(
"researchIds"
)
List
<
Long
>
researchIds
);
...
@@ -112,4 +113,11 @@ public interface ResearchMapper extends BaseMapper<Research> {
...
@@ -112,4 +113,11 @@ public interface ResearchMapper extends BaseMapper<Research> {
List
<
Research
>
getPageToCalendar
(
@Param
(
"finishTrIds"
)
List
<
Long
>
finishTrIds
,
@Param
(
"trIds"
)
List
<
Long
>
trIds
,
@Param
(
"date"
)
Date
date
,
@Param
(
"siteId"
)
Long
siteId
,
Page
<
Research
>
page
);
List
<
Research
>
getPageToCalendar
(
@Param
(
"finishTrIds"
)
List
<
Long
>
finishTrIds
,
@Param
(
"trIds"
)
List
<
Long
>
trIds
,
@Param
(
"date"
)
Date
date
,
@Param
(
"siteId"
)
Long
siteId
,
Page
<
Research
>
page
);
Integer
getPageToCalendarNum
(
@Param
(
"finishTrIds"
)
List
<
Long
>
finishTrIds
,
@Param
(
"trIds"
)
List
<
Long
>
trIds
,
@Param
(
"date"
)
Date
date
,
@Param
(
"siteId"
)
Long
siteId
);
Integer
getPageToCalendarNum
(
@Param
(
"finishTrIds"
)
List
<
Long
>
finishTrIds
,
@Param
(
"trIds"
)
List
<
Long
>
trIds
,
@Param
(
"date"
)
Date
date
,
@Param
(
"siteId"
)
Long
siteId
);
/**
* 获取置顶的调研信息
* @param bizType
* @return
*/
List
<
ResearchVo
>
getResearchTop
(
@Param
(
"bizType"
)
Integer
bizType
,
@Param
(
"siteId"
)
Long
siteId
);
}
}
cloud-research-service/src/main/java/com/yizhi/research/application/mapper/ResearchMapper.xml
View file @
c41299d4
...
@@ -170,6 +170,51 @@
...
@@ -170,6 +170,51 @@
group by tb.id
group by tb.id
order by tb.end_time
order by tb.end_time
</if>
</if>
<if
test=
"state == null"
>
select *
from (select answer.submit_time as submitTime,
CASE WHEN
<![CDATA[ tb.start_time > NOW() ]]>
THEN 0 ELSE
CASE WHEN
<![CDATA[ tb.start_time >= NOW() ]]>
AND answerf.finish IS NULL THEN 4 ELSE
CASE WHEN answerf.finish=1 THEN 1 ELSE
CASE WHEN
<![CDATA[ tb.end_time < NOW() ]]>
THEN 3 ELSE
2
END
END
END
END AS finishState
,tb.id AS id
,answer.submit_time as finishTime
,tb.research_no AS researchNo
,tb.name AS name
,tb.start_time AS startTime
,tb.end_time AS endTime
,tb.visible_range AS visibleRange
,tb.content AS content
,tb.state AS state
,tb.deleted AS deleted
,tb.company_id AS companyId
,tb.org_id AS orgId
,tb.site_id AS siteId
,tb.image
from research tb
left join tr_research_answer answer on answer.research_id = tb.id and answer.account_id = #{accountId} and answer.finish=1
left join tr_research_answer answerf on answer.research_id = tb.id and answerf.account_id = #{accountId} and answerf.finish in(0,1)
where
-- 状态、站点
tb.deleted = 0 and tb.site_id = #{siteId}
-- 可见范围
and (tb.visible_range = 1
<if
test=
"idsInRange != null and idsInRange.size > 0"
>
or (tb.visible_range = 2 and tb.id in
(
<foreach
collection=
"idsInRange"
separator=
","
item=
"id"
>
#{id}
</foreach>
))
</if>
)
and tb.biz_type=#{bizType}
group by tb.id
)t
order by t.endTime desc,id
</if>
</select>
</select>
<!-- 查询进行中的我的调研 -->
<!-- 查询进行中的我的调研 -->
...
@@ -360,6 +405,24 @@
...
@@ -360,6 +405,24 @@
group by tb.id
group by tb.id
order by tb.end_time
order by tb.end_time
</if>
</if>
<if
test=
"state == null"
>
select
tb.id AS id
from research tb
where
-- 状态、站点
tb.deleted = 0 and tb.site_id = #{siteId}
-- 可见范围
and (tb.visible_range = 1
<if
test=
"idsInRange != null and idsInRange.size > 0"
>
or (tb.visible_range = 2 and tb.id in
(
<foreach
collection=
"idsInRange"
separator=
","
item=
"id"
>
#{id}
</foreach>
))
</if>
)
and tb.biz_type=#{bizType}
group by tb.id
</if>
)ttt
)ttt
</select>
</select>
...
@@ -495,7 +558,11 @@
...
@@ -495,7 +558,11 @@
and c.deleted = 0
and c.deleted = 0
AND
<![CDATA[ DATE_FORMAT(c.start_time, '%Y-%m-%d') <= DATE_FORMAT(#{date}, '%Y-%m-%d') ]]>
AND
<![CDATA[ DATE_FORMAT(c.start_time, '%Y-%m-%d') <= DATE_FORMAT(#{date}, '%Y-%m-%d') ]]>
AND
<![CDATA[ DATE_FORMAT(c.end_time, '%Y-%m-%d') >= DATE_FORMAT(#{date}, '%Y-%m-%d') ]]>
AND
<![CDATA[ DATE_FORMAT(c.end_time, '%Y-%m-%d') >= DATE_FORMAT(#{date}, '%Y-%m-%d') ]]>
</select>
</select>
<select
id=
"getResearchTop"
resultType=
"com.yizhi.research.application.vo.domain.ResearchVo"
>
select tb.id,tb.name,tb.image AS logo_img,tb.create_by_name,tb.create_time
from research tb
where tb.site_id = #{siteId} and tb.biz_type = #{bizType} and tb.state = 1 and tb.top_up = 1 and tb.deleted = 0
</select>
</mapper>
</mapper>
cloud-research-service/src/main/java/com/yizhi/research/application/service/IResearchService.java
View file @
c41299d4
...
@@ -146,4 +146,11 @@ public interface IResearchService extends IService<Research> {
...
@@ -146,4 +146,11 @@ public interface IResearchService extends IService<Research> {
* @return
* @return
*/
*/
Research
viewInfo
(
Long
id
);
Research
viewInfo
(
Long
id
);
/**
* 获取置顶的调研信息
* @param bizType
* @return
*/
List
<
ResearchVo
>
getResearchTop
(
Integer
bizType
);
}
}
cloud-research-service/src/main/java/com/yizhi/research/application/service/impl/ResearchServiceImpl.java
View file @
c41299d4
...
@@ -421,10 +421,10 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
...
@@ -421,10 +421,10 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
researchIdsInRange
=
researchAuthorizeMapper
.
getResearchIdsInRange
(
context
.
getRelationIds
());
researchIdsInRange
=
researchAuthorizeMapper
.
getResearchIdsInRange
(
context
.
getRelationIds
());
}
}
List
<
Research
>
records
=
researchMapper
.
apiListResearch
(
researchIdsInRange
,
context
.
getAccountId
(),
List
<
Research
>
records
=
researchMapper
.
apiListResearch
(
researchIdsInRange
,
context
.
getAccountId
(),
context
.
getSiteId
(),
model
.
getDate
(),
pageVo
.
getState
(),
new
RowBounds
(
page
.
getOffset
(),
page
.
getLimit
()));
context
.
getSiteId
(),
model
.
getDate
(),
pageVo
.
getState
(),
pageVo
.
getBizType
(),
new
RowBounds
(
page
.
getOffset
(),
page
.
getLimit
()));
// 如果是已完成:还要判断是否过期
// 如果是已完成:还要判断是否过期
if
(
pageVo
.
getState
().
equals
(
1
))
{
if
(
pageVo
.
getState
()
!=
null
&&
pageVo
.
getState
()
.
equals
(
1
))
{
if
(!
CollectionUtils
.
isEmpty
(
records
))
{
if
(!
CollectionUtils
.
isEmpty
(
records
))
{
Map
<
Long
,
Research
>
map
=
new
LinkedHashMap
<>();
Map
<
Long
,
Research
>
map
=
new
LinkedHashMap
<>();
for
(
Research
r
:
records
)
{
for
(
Research
r
:
records
)
{
...
@@ -454,7 +454,7 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
...
@@ -454,7 +454,7 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
page
.
setRecords
(
records
);
page
.
setRecords
(
records
);
int
count
=
0
;
int
count
=
0
;
count
=
researchMapper
.
selectListCount
(
researchIdsInRange
,
context
.
getAccountId
(),
count
=
researchMapper
.
selectListCount
(
researchIdsInRange
,
context
.
getAccountId
(),
context
.
getSiteId
(),
model
.
getDate
(),
pageVo
.
getState
());
context
.
getSiteId
(),
model
.
getDate
(),
pageVo
.
getState
()
,
pageVo
.
getBizType
()
);
if
(
count
<
0
)
{
if
(
count
<
0
)
{
count
=
0
;
count
=
0
;
}
}
...
@@ -851,4 +851,12 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
...
@@ -851,4 +851,12 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
Research
research
=
researchMapper
.
selectById
(
id
);
Research
research
=
researchMapper
.
selectById
(
id
);
return
research
;
return
research
;
}
}
@Override
public
List
<
ResearchVo
>
getResearchTop
(
Integer
bizType
)
{
RequestContext
requestContext
=
ContextHolder
.
get
();
Long
siteId
=
requestContext
.
getSiteId
();
return
researchMapper
.
getResearchTop
(
bizType
,
siteId
);
}
}
}
cloud-research-service/src/main/java/com/yizhi/research/application/vo/domain/Research.java
View file @
c41299d4
...
@@ -207,7 +207,7 @@ public class Research extends Model<Research> {
...
@@ -207,7 +207,7 @@ public class Research extends Model<Research> {
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
List
<
TrResearchAnswer
>
trResearchAnswers
;
private
List
<
TrResearchAnswer
>
trResearchAnswers
;
@ApiModelProperty
(
value
=
"搜索列表显示状态:
1已完成,2进行中,3已过期
"
)
@ApiModelProperty
(
value
=
"搜索列表显示状态:
0未开始,1已完成,2进行中,3已过期,4未参加调研
"
)
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
Integer
finishState
;
private
Integer
finishState
;
...
...
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