Browse Source

增加分享任务的免登录查询任务详细接口

master
陈裕财 5 years ago
parent
commit
12a8ab7a17
  1. 2
      xm-bootstrap/src/main/java/com/xm/WebSecurityConfig.java
  2. 27
      xm-core/src/main/java/com/xm/core/ctrl/XmTaskController.java
  3. 4
      xm-core/src/main/java/com/xm/core/service/XmTaskService.java
  4. 4
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTaskMapper.xml
  5. 2
      xm-core/src/test/java/com/xm/WebSecurityConfig.java

2
xm-bootstrap/src/main/java/com/xm/WebSecurityConfig.java

@ -37,7 +37,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
*/ */
@Override @Override
protected void configure(HttpSecurity http) throws Exception { protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().authenticated();
http.authorizeRequests().antMatchers("/**/xm/core/xmTask/shareTaskDetail").permitAll().anyRequest().authenticated();
http.oauth2Client().and().logout().disable(); http.oauth2Client().and().logout().disable();
http.formLogin().usernameParameter("userloginid"); http.formLogin().usernameParameter("userloginid");
http.oauth2Login(); http.oauth2Login();

27
xm-core/src/main/java/com/xm/core/ctrl/XmTaskController.java

@ -115,6 +115,33 @@ public class XmTaskController {
return m; return m;
} }
@ApiOperation( value = "查询任务的信息详情,免登录",notes="taskDetail,条件之间是 and关系,模糊查询写法如 {studentName:'%才哥%'}")
@ApiResponses({
@ApiResponse(code = 200,response= XmTask.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},pageInfo:{total:总记录数},data:[数据对象1,数据对象2,...]}")
})
@RequestMapping(value="/shareTaskDetail",method=RequestMethod.GET)
public Map<String,Object> taskDetail( @RequestParam Map<String,Object> xmTask){
Tips tips=new Tips("查询成功");
Map<String,Object> m = new HashMap<>();
String id=(String) xmTask.get("id");
String shareKey= (String) xmTask.get("shareKey");
if(!StringUtils.hasText(id)){
tips.setFailureMsg("任务编号id必传");
}
if(!StringUtils.hasText(shareKey)){
tips.setFailureMsg("分享码shareKey必传");
}
//todo 检测分析妈的正确性
if(tips.isOk()){
Map<String,Object> taskDb= xmTaskService.shareTaskDetail(xmTask);
m.put("data",taskDb);
m.put("tips", tips);
}
m.put("tips", tips);
return m;
}
@ApiOperation( value = "新增一条xm_task信息",notes="addXmTask,主键如果为空,后台自动生成") @ApiOperation( value = "新增一条xm_task信息",notes="addXmTask,主键如果为空,后台自动生成")
@ApiResponses({ @ApiResponses({
@ApiResponse(code = 200,response=XmTask.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}") @ApiResponse(code = 200,response=XmTask.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'失败时错误码'},data:数据对象}")

4
xm-core/src/main/java/com/xm/core/service/XmTaskService.java

@ -382,6 +382,10 @@ public class XmTaskService extends BaseService {
} }
} }
public Map<String,Object> shareTaskDetail(Map<String, Object> xmTask) {
return this.selectOne("shareTaskDetail",xmTask);
}
/** 请在此类添加自定义函数 */ /** 请在此类添加自定义函数 */
} }

4
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTaskMapper.xml

@ -9,6 +9,10 @@
select avg(res.rate) from XM.xm_task res where res.parent_taskid = #{parentTaskid} select avg(res.rate) from XM.xm_task res where res.parent_taskid = #{parentTaskid}
</select> </select>
<select id="shareTaskDetail" parameterType="HashMap" resultType="HashMap">
SELECT res.*,m.remark from XM.xm_task res left join XM.xm_menu m on res.menu_id = m.menu_id
WHERE res.id=#{id}
</select>
<select id="checkExistsExecuser" parameterType="String" resultType="Long" > <select id="checkExistsExecuser" parameterType="String" resultType="Long" >
select count(1) from XM.xm_task_execuser res where res.task_id = #{taskId} and ( res.settle_status not in('2','6')) select count(1) from XM.xm_task_execuser res where res.task_id = #{taskId} and ( res.settle_status not in('2','6'))
</select> </select>

2
xm-core/src/test/java/com/xm/WebSecurityConfig.java

@ -40,7 +40,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
*/ */
@Override @Override
protected void configure(HttpSecurity http) throws Exception { protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().authenticated();
http.authorizeRequests().antMatchers("/**/xm/core/xmTask/shareTaskDetail").permitAll().anyRequest().authenticated();
http.oauth2Client().and().logout().disable(); http.oauth2Client().and().logout().disable();
http.formLogin().usernameParameter("userloginid"); http.formLogin().usernameParameter("userloginid");
http.oauth2Login(); http.oauth2Login();

Loading…
Cancel
Save