|
|
@@ -9,6 +9,7 @@ import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.web.domain.*;
|
|
|
+import com.ruoyi.web.exception.ErrorMessageException;
|
|
|
import com.ruoyi.web.service.*;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -44,12 +45,47 @@ public class HdInfoController extends BaseController
|
|
|
this.hdQdService = hdQdService;
|
|
|
}
|
|
|
|
|
|
+ private IHdZdService hdZdService;
|
|
|
+ @Autowired
|
|
|
+ public void setHdZdService(IHdZdService hdZdService) {
|
|
|
+ this.hdZdService = hdZdService;
|
|
|
+ }
|
|
|
+
|
|
|
private HdInfo getHdInfo(Date date){
|
|
|
QueryWrapper<HdInfo> qw = new QueryWrapper<>();
|
|
|
qw.lambda().eq(HdInfo::getHdrq,date);
|
|
|
return hdInfoService.getOne(qw);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/user/wqd/{id}")
|
|
|
+ @ApiOperation("未签到用户列表")
|
|
|
+ public AjaxResult hdWqd(@PathVariable Long id){
|
|
|
+ return success(hdInfoService.hdWqd(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/user/bq")
|
|
|
+ @ApiOperation("帮签")
|
|
|
+ public AjaxResult bq(@RequestBody HdQd hdQd){
|
|
|
+ hdQd.setQdsj(DateUtils.getNowDate());
|
|
|
+ hdQdService.save(hdQd);
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/user/bqq")
|
|
|
+ @ApiOperation("帮取签")
|
|
|
+ public AjaxResult bqq(@RequestBody HdQd hdQd){
|
|
|
+ QueryWrapper<HdQd> qw = new QueryWrapper<>();
|
|
|
+ qw.lambda().eq(HdQd::getFid,hdQd.getFid()).eq(HdQd::getUserId,hdQd.getUserId());
|
|
|
+ hdQdService.remove(qw);
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/user/{id}")
|
|
|
+ @ApiOperation("活动参与人员")
|
|
|
+ public AjaxResult hdUser(@PathVariable Long id){
|
|
|
+ return success(hdInfoService.hdUser(id));
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/user/grls")
|
|
|
@ApiOperation("个人历史")
|
|
|
public AjaxResult grls(){
|
|
|
@@ -57,12 +93,14 @@ public class HdInfoController extends BaseController
|
|
|
hqQW.lambda().eq(HdQd::getUserId,SecurityUtils.getUserId());
|
|
|
Set<Long> hdIdSet = hdQdService.list(hqQW).stream().map(HdQd::getFid).collect(Collectors.toSet());
|
|
|
if (hdIdSet.isEmpty()) return success(Collections.emptyList());
|
|
|
- return success(hdInfoService.listByIds(hdIdSet));
|
|
|
+ QueryWrapper<HdInfo> qw = new QueryWrapper<>();
|
|
|
+ qw.lambda().in(HdInfo::getId,hdIdSet).orderByDesc(HdInfo::getHdrq);
|
|
|
+ return success(hdInfoService.list(qw));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/user/verify")
|
|
|
@ApiOperation("校验是否签到")
|
|
|
- public AjaxResult verify(String date) {
|
|
|
+ public AjaxResult verifyQd(String date) {
|
|
|
Date hdrq = DateUtils.getNowDate();
|
|
|
if(StringUtils.isNotEmpty(date)) hdrq = DateUtils.parseDate(date);
|
|
|
HdInfo hdInfo = getHdInfo(hdrq);
|
|
|
@@ -85,6 +123,7 @@ public class HdInfoController extends BaseController
|
|
|
hdInfo.setHdrq(hdrq);
|
|
|
hdInfoService.save(hdInfo);
|
|
|
}
|
|
|
+ if (getJszt(hdInfo.getId())) throw new ErrorMessageException("账单已结算,禁止签到");
|
|
|
HdQd hdQd = new HdQd();
|
|
|
hdQd.setFid(hdInfo.getId());
|
|
|
hdQd.setUserId(SecurityUtils.getUserId());
|
|
|
@@ -99,6 +138,7 @@ public class HdInfoController extends BaseController
|
|
|
Date hdrq = DateUtils.getNowDate();
|
|
|
if(StringUtils.isNotEmpty(date)) hdrq = DateUtils.parseDate(date);
|
|
|
HdInfo hdInfo = getHdInfo(hdrq);
|
|
|
+ if (getJszt(hdInfo.getId())) throw new ErrorMessageException("账单已结算,禁止取消签到");
|
|
|
QueryWrapper<HdQd> qw = new QueryWrapper<>();
|
|
|
qw.lambda().eq(HdQd::getUserId,SecurityUtils.getUserId()).eq(HdQd::getFid,hdInfo.getId());
|
|
|
hdQdService.remove(qw);
|
|
|
@@ -138,7 +178,16 @@ public class HdInfoController extends BaseController
|
|
|
@GetMapping(value = "/{id}")
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
{
|
|
|
- return success(hdInfoService.getById(id));
|
|
|
+ HdInfo hdInfo = hdInfoService.getById(id);
|
|
|
+ hdInfo.setJszt(getJszt(hdInfo.getId()));
|
|
|
+ return success(hdInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean getJszt(Long id){
|
|
|
+ QueryWrapper<HdZd> qw = new QueryWrapper<>();
|
|
|
+ qw.lambda().eq(HdZd::getHdId,id);
|
|
|
+ HdZd hdZd = hdZdService.getOne(qw);
|
|
|
+ return !Objects.isNull(hdZd);
|
|
|
}
|
|
|
|
|
|
/**
|