|
|
@@ -3,17 +3,13 @@ package com.ruoyi.web.controller;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import javax.validation.constraints.NotBlank;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
-import com.ruoyi.web.domain.GrzdVO;
|
|
|
-import com.ruoyi.web.domain.HdUser;
|
|
|
-import com.ruoyi.web.domain.HisZd;
|
|
|
-import com.ruoyi.web.service.IHdUserService;
|
|
|
-import com.ruoyi.web.service.IHisZdService;
|
|
|
+import com.ruoyi.web.domain.*;
|
|
|
+import com.ruoyi.web.service.*;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
@@ -22,8 +18,6 @@ import com.ruoyi.common.annotation.Log;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
-import com.ruoyi.web.domain.HdInfo;
|
|
|
-import com.ruoyi.web.service.IHdInfoService;
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
|
@@ -44,16 +38,10 @@ public class HdInfoController extends BaseController
|
|
|
this.hdInfoService = hdInfoService;
|
|
|
}
|
|
|
|
|
|
- private IHdUserService hdUserService;
|
|
|
+ private IHdQdService hdQdService;
|
|
|
@Autowired
|
|
|
- public void setHdUserService(IHdUserService hdUserService) {
|
|
|
- this.hdUserService = hdUserService;
|
|
|
- }
|
|
|
-
|
|
|
- private IHisZdService hisZdService;
|
|
|
- @Autowired
|
|
|
- public void setHisZdService(IHisZdService hisZdService) {
|
|
|
- this.hisZdService = hisZdService;
|
|
|
+ public void setHdQdService(IHdQdService hdQdService) {
|
|
|
+ this.hdQdService = hdQdService;
|
|
|
}
|
|
|
|
|
|
private HdInfo getHdInfo(Date date){
|
|
|
@@ -62,6 +50,16 @@ public class HdInfoController extends BaseController
|
|
|
return hdInfoService.getOne(qw);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/user/grls")
|
|
|
+ @ApiOperation("个人历史")
|
|
|
+ public AjaxResult grls(){
|
|
|
+ QueryWrapper<HdQd> hqQW = new QueryWrapper<>();
|
|
|
+ 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));
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/user/verify")
|
|
|
@ApiOperation("校验是否签到")
|
|
|
public AjaxResult verify(String date) {
|
|
|
@@ -69,9 +67,11 @@ public class HdInfoController extends BaseController
|
|
|
if(StringUtils.isNotEmpty(date)) hdrq = DateUtils.parseDate(date);
|
|
|
HdInfo hdInfo = getHdInfo(hdrq);
|
|
|
if (Objects.isNull(hdInfo)) return success(false);
|
|
|
- QueryWrapper<HdUser> huQW = new QueryWrapper<>();
|
|
|
- huQW.lambda().eq(HdUser::getFid,hdInfo.getId()).eq(HdUser::getUserId,SecurityUtils.getUserId());
|
|
|
- return success(!Objects.isNull(hdUserService.getOne(huQW)));
|
|
|
+ QueryWrapper<HdQd> qw = new QueryWrapper<>();
|
|
|
+ qw.lambda().eq(HdQd::getUserId,SecurityUtils.getUserId()).eq(HdQd::getFid,hdInfo.getId());
|
|
|
+ HdQd hdQd = hdQdService.getOne(qw);
|
|
|
+ if (Objects.isNull(hdQd)) return success(false);
|
|
|
+ return success(true);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/user/qd")
|
|
|
@@ -85,11 +85,11 @@ public class HdInfoController extends BaseController
|
|
|
hdInfo.setHdrq(hdrq);
|
|
|
hdInfoService.save(hdInfo);
|
|
|
}
|
|
|
- Long id = hdInfo.getId();
|
|
|
- HdUser hdUser = new HdUser();
|
|
|
- hdUser.setFid(id);
|
|
|
- hdUser.setUserId(SecurityUtils.getUserId());
|
|
|
- hdUserService.save(hdUser);
|
|
|
+ HdQd hdQd = new HdQd();
|
|
|
+ hdQd.setFid(hdInfo.getId());
|
|
|
+ hdQd.setUserId(SecurityUtils.getUserId());
|
|
|
+ hdQd.setQdsj(DateUtils.getNowDate());
|
|
|
+ hdQdService.save(hdQd);
|
|
|
return success();
|
|
|
}
|
|
|
|
|
|
@@ -99,45 +99,9 @@ public class HdInfoController extends BaseController
|
|
|
Date hdrq = DateUtils.getNowDate();
|
|
|
if(StringUtils.isNotEmpty(date)) hdrq = DateUtils.parseDate(date);
|
|
|
HdInfo hdInfo = getHdInfo(hdrq);
|
|
|
- HdUser hdUser = new HdUser();
|
|
|
- hdUser.setFid(hdInfo.getId());
|
|
|
- hdUser.setUserId(SecurityUtils.getUserId());
|
|
|
- QueryWrapper<HdUser> qw = new QueryWrapper<>();
|
|
|
- qw.setEntity(hdUser);
|
|
|
- hdUserService.remove(qw);
|
|
|
- return success();
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/user/his")
|
|
|
- @ApiOperation("历史记录")
|
|
|
- public TableDataInfo userHis(){
|
|
|
- QueryWrapper<HdUser> qw = new QueryWrapper<>();
|
|
|
- qw.lambda().eq(HdUser::getUserId,SecurityUtils.getUserId());
|
|
|
- List<Long> idList = hdUserService.list(qw).stream().map(HdUser::getFid).collect(Collectors.toList());
|
|
|
- if (idList.isEmpty()) return getDataTable(new ArrayList<>());
|
|
|
- startPage();
|
|
|
- return getDataTable(hdInfoService.listByIds(idList));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/user/grzd")
|
|
|
- @ApiOperation("个人账单")
|
|
|
- public TableDataInfo grzd(String ny){
|
|
|
- startPage();
|
|
|
- return getDataTable(hdInfoService.grzd(ny));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/user/grzd/{ny}")
|
|
|
- @ApiOperation("个人账单详情")
|
|
|
- public AjaxResult grzdDetail(@PathVariable String ny){
|
|
|
- List<GrzdVO> voList = hdInfoService.grzd(ny);
|
|
|
- return success(voList.get(0));
|
|
|
- }
|
|
|
-
|
|
|
- @PostMapping("/user/grzd/zf")
|
|
|
- @ApiOperation("个人账单支付")
|
|
|
- public AjaxResult grzdZf(@RequestBody HisZd hisZd){
|
|
|
- hisZd.setUserId(SecurityUtils.getUserId());
|
|
|
- hisZdService.save(hisZd);
|
|
|
+ QueryWrapper<HdQd> qw = new QueryWrapper<>();
|
|
|
+ qw.lambda().eq(HdQd::getUserId,SecurityUtils.getUserId()).eq(HdQd::getFid,hdInfo.getId());
|
|
|
+ hdQdService.remove(qw);
|
|
|
return success();
|
|
|
}
|
|
|
|