@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated ;
import org.springframework.web.bind.annotation.* ;
import javax.validation.constraints.Max ;
import javax.validation.constraints.Min ;
import javax.validation.constraints.NotNull ;
import java.time.LocalDateTime ;
@ -69,7 +70,9 @@ public class TaskUController {
static class ListTParam {
private int pageNum ;
private int pageSize ;
@Schema ( title = "任务状态" , description = "0未上线; 1已上线; 2已结束; 3待领取" )
@Schema ( title = "用户的任务状态" , description = "0待领取; 1进行中; 2已完成" )
@Min ( value = 0 )
@Max ( value = 2 )
private Integer status ;
@Schema ( title = "月份区间" )
private Integer month ;
@ -86,11 +89,15 @@ public class TaskUController {
public Result list ( @Validated @RequestBody ListTParam param , @RequestHeader ( required = false , value = "token" ) @Parameter ( name = "用户token" , description = "关联用户信息" ) String token ) {
QueryWrapper < Reference > qw = new QueryWrapper < > ( ) ;
Integer status = param . getStatus ( ) ;
qw . ne ( "t1.status" , 0 ) ;
if ( null ! = status ) {
qw . eq ( "t1.status" , status = = 3 ? 1 : status ) ;
if ( status = = 3 ) {
qw . eq ( "t1.status" , status = = 2 ? 2 : 1 ) ;
if ( status = = 0 ) {
qw . ne ( "(SELECT count(*)!=0 from userTask as t4,user as t5 WHERE t1.id = t4.taskId and t4.userId = t5.id and t5.openid = +'" + new JwtUtil ( ) . parseOpenid ( token ) + "' )" , 1 ) ;
}
else if ( status = = 1 ) {
qw . eq ( "(SELECT count(*)!=0 from userTask as t4,user as t5 WHERE t1.id = t4.taskId and t4.userId = t5.id and t5.openid = +'" + new JwtUtil ( ) . parseOpenid ( token ) + "' )" , 1 ) ;
}
}
if ( null ! = param . getMonth ( ) ) {
qw . between ( "t1.creatAt" , LocalDateTime . now ( ) . minusMonths ( param . getMonth ( ) ) , LocalDateTime . now ( ) ) ;