Commit ee01c1b0 by 梅存智

Merge branch 'dev' into 'master'

查看调研详情接口

See merge request !2
parents 753e294e 7bfded67
...@@ -217,6 +217,15 @@ public interface ResearchClient { ...@@ -217,6 +217,15 @@ public interface ResearchClient {
*/ */
@GetMapping("/research/top/get") @GetMapping("/research/top/get")
List<ResearchVo> getResearchTop(@RequestParam("bizType") Integer bizType); List<ResearchVo> getResearchTop(@RequestParam("bizType") Integer bizType);
/**
* 查看研信详情
*
* @param id
* @return
*/
@GetMapping("/research/details")
ResearchVo getResearchDetails(@RequestParam("id") Long id);
} }
...@@ -408,5 +408,16 @@ public class ResearchController { ...@@ -408,5 +408,16 @@ public class ResearchController {
List<ResearchVo> getResearchTop(@RequestParam("bizType") Integer bizType){ List<ResearchVo> getResearchTop(@RequestParam("bizType") Integer bizType){
return researchService.getResearchTop(bizType); return researchService.getResearchTop(bizType);
} }
/**
* 查看调研详情
*
* @param id
* @return
*/
@GetMapping("/details")
ResearchVo getResearchDetails(@RequestParam("id") Long id) {
return researchService.getResearchDetails(id);
}
} }
...@@ -120,4 +120,13 @@ public interface ResearchMapper extends BaseMapper<Research> { ...@@ -120,4 +120,13 @@ public interface ResearchMapper extends BaseMapper<Research> {
* @return * @return
*/ */
List<ResearchVo> getResearchTop(@Param("bizType") Integer bizType, @Param("siteId") Long siteId); List<ResearchVo> getResearchTop(@Param("bizType") Integer bizType, @Param("siteId") Long siteId);
/**
* 查看调研详情
* @param id
* @param siteId
* @param accountId
* @return
*/
ResearchVo selectResearchDetails(@Param("id") Long id, @Param("accountId") Long accountId, @Param("siteId") Long siteId);
} }
...@@ -565,4 +565,31 @@ ...@@ -565,4 +565,31 @@
from research tb 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 where tb.site_id = #{siteId} and tb.biz_type = #{bizType} and tb.state = 1 and tb.top_up = 1 and tb.deleted = 0
</select> </select>
<select id="selectResearchDetails" resultType="com.yizhi.research.application.vo.domain.ResearchVo">
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.content AS content
,tb.remark
,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.id=#{id} and tb.deleted = 0 and tb.site_id = #{siteId}
group by tb.id
</select>
</mapper> </mapper>
...@@ -153,4 +153,11 @@ public interface IResearchService extends IService<Research> { ...@@ -153,4 +153,11 @@ public interface IResearchService extends IService<Research> {
* @return * @return
*/ */
List<ResearchVo> getResearchTop(Integer bizType); List<ResearchVo> getResearchTop(Integer bizType);
/**
* 查看调研详情
* @param id
* @return
*/
ResearchVo getResearchDetails(Long id);
} }
...@@ -859,4 +859,17 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i ...@@ -859,4 +859,17 @@ public class ResearchServiceImpl extends ServiceImpl<ResearchMapper, Research> i
Long siteId = requestContext.getSiteId(); Long siteId = requestContext.getSiteId();
return researchMapper.getResearchTop(bizType, siteId); return researchMapper.getResearchTop(bizType, siteId);
} }
@Override
public ResearchVo getResearchDetails(Long id) {
RequestContext requestContext = ContextHolder.get();
if(requestContext == null){
return null;
}
ResearchVo research = researchMapper.selectResearchDetails(id, requestContext.getAccountId(), requestContext.getSiteId());
return research;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment