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
753e294e
Commit
753e294e
authored
Dec 02, 2024
by
梅存智
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
Dev See merge request
!1
parents
d9e22ef6
c41299d4
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
157 additions
and
10 deletions
+157
-10
cloud-research-api/src/main/java/com/yizhi/research/application/feign/ResearchClient.java
+17
-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
+3
-1
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
+20
-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
+68
-1
cloud-research-service/src/main/java/com/yizhi/research/application/service/IResearchService.java
+16
-0
cloud-research-service/src/main/java/com/yizhi/research/application/service/impl/ResearchServiceImpl.java
+18
-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 @
753e294e
...
...
@@ -200,6 +200,23 @@ public interface ResearchClient {
@RequestParam
(
value
=
"value"
,
required
=
false
)
String
value
,
@RequestParam
(
"pageNo"
)
Integer
pageNo
,
@RequestParam
(
"pageSize"
)
Integer
pageSize
);
/**
* 查看一个调研信息
*
* @param id
* @return
*/
@GetMapping
(
"/research/info"
)
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 @
753e294e
...
...
@@ -22,4 +22,6 @@ public class PageVo {
private
Integer
pageNo
;
private
Integer
pageSize
;
private
Integer
bizType
;
}
cloud-research-api/src/main/java/com/yizhi/research/application/vo/domain/ResearchVo.java
View file @
753e294e
...
...
@@ -207,7 +207,7 @@ public class ResearchVo {
private
List
<
TrResearchAnswerVo
>
trResearchAnswerVos
;
@ApiModelProperty
(
value
=
"搜索列表显示状态:
1已完成,2进行中,3已过期
"
)
@ApiModelProperty
(
value
=
"搜索列表显示状态:
0未开始,1已完成,2进行中,3已过期,4未参加调研
"
)
private
Integer
finishState
;
...
...
@@ -233,4 +233,6 @@ public class ResearchVo {
@ApiModelProperty
(
value
=
"调研logo"
)
private
String
image
;
@ApiModelProperty
(
value
=
"调研logo"
)
private
String
logoImg
;
}
cloud-research-service/src/main/java/com/yizhi/research/application/SwaggerConfig.java
View file @
753e294e
...
...
@@ -12,10 +12,10 @@ import springfox.documentation.spring.web.plugins.Docket;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@Configuration
@EnableSwagger2
//
@EnableSwagger2
public
class
SwaggerConfig
{
@Value
(
"${swagger.enabled}"
)
//
@Value("${swagger.enabled}")
private
boolean
swaggerEnabled
;
@Bean
public
Docket
createRestApi
()
{
...
...
cloud-research-service/src/main/java/com/yizhi/research/application/controller/ResearchController.java
View file @
753e294e
...
...
@@ -388,5 +388,25 @@ public class ResearchController {
return
researchService
.
getPageByDrools
(
field
,
value
,
page
);
}
/**
* 查看一个调研信息
*
* @param id
* @return
*/
@GetMapping
(
"/info"
)
Research
viewInfo
(
@RequestParam
(
"id"
)
Long
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 @
753e294e
...
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.yizhi.research.application.model.DataRangeModel
;
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
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
...
...
@@ -60,7 +61,7 @@ public interface ResearchMapper extends BaseMapper<Research> {
* @return
*/
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
);
/**
...
...
@@ -80,7 +81,7 @@ public interface ResearchMapper extends BaseMapper<Research> {
@Param
(
"siteId"
)
Long
siteId
,
@Param
(
"now"
)
Date
now
);
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
);
...
...
@@ -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
);
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 @
753e294e
...
...
@@ -170,6 +170,51 @@
group by tb.id
order by tb.end_time
</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>
<!-- 查询进行中的我的调研 -->
...
...
@@ -360,6 +405,24 @@
group by tb.id
order by tb.end_time
</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
</select>
...
...
@@ -495,7 +558,11 @@
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.end_time, '%Y-%m-%d') >= DATE_FORMAT(#{date}, '%Y-%m-%d') ]]>
</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>
cloud-research-service/src/main/java/com/yizhi/research/application/service/IResearchService.java
View file @
753e294e
...
...
@@ -9,6 +9,8 @@ import com.yizhi.research.application.vo.BaseModel;
import
com.yizhi.research.application.vo.VisibleRangeExport
;
import
com.yizhi.research.application.vo.api.PageVo
;
import
com.yizhi.research.application.vo.domain.Research
;
import
com.yizhi.research.application.vo.domain.ResearchVo
;
import
io.swagger.annotations.ApiParam
;
import
java.util.Date
;
...
...
@@ -137,4 +139,18 @@ public interface IResearchService extends IService<Research> {
Page
<
Research
>
getPageToCalendar
(
Date
date
,
Page
<
Research
>
page
);
Page
<
DroolsVo
>
getPageByDrools
(
String
field
,
String
value
,
Page
<
DroolsVo
>
page
);
/**
* 查看调研信息
* @param id
* @return
*/
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 @
753e294e
...
...
@@ -421,10 +421,10 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
researchIdsInRange
=
researchAuthorizeMapper
.
getResearchIdsInRange
(
context
.
getRelationIds
());
}
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
))
{
Map
<
Long
,
Research
>
map
=
new
LinkedHashMap
<>();
for
(
Research
r
:
records
)
{
...
...
@@ -454,7 +454,7 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
page
.
setRecords
(
records
);
int
count
=
0
;
count
=
researchMapper
.
selectListCount
(
researchIdsInRange
,
context
.
getAccountId
(),
context
.
getSiteId
(),
model
.
getDate
(),
pageVo
.
getState
());
context
.
getSiteId
(),
model
.
getDate
(),
pageVo
.
getState
()
,
pageVo
.
getBizType
()
);
if
(
count
<
0
)
{
count
=
0
;
}
...
...
@@ -844,4 +844,19 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
}
return
page
;
}
@Override
public
Research
viewInfo
(
Long
id
)
{
Research
research
=
researchMapper
.
selectById
(
id
);
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 @
753e294e
...
...
@@ -207,7 +207,7 @@ public class Research extends Model<Research> {
@TableField
(
exist
=
false
)
private
List
<
TrResearchAnswer
>
trResearchAnswers
;
@ApiModelProperty
(
value
=
"搜索列表显示状态:
1已完成,2进行中,3已过期
"
)
@ApiModelProperty
(
value
=
"搜索列表显示状态:
0未开始,1已完成,2进行中,3已过期,4未参加调研
"
)
@TableField
(
exist
=
false
)
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