diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzAppController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzAppController.java index cc2e5d0..8ab2c0d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzAppController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzAppController.java @@ -1,661 +1,661 @@ -package com.ruoyi.web.controller.wgz.controller; + package com.ruoyi.web.controller.wgz.controller; -import com.ruoyi.bgt.domain.BgtProjectRecruit; -import com.ruoyi.bgt.domain.BgtProjectRecruitApply; -import com.ruoyi.bgt.domain.dto.BgtProjectRecruitQueryDTO; -import com.ruoyi.bgt.domain.vo.BgtProjectRecruitVO; -import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService; -import com.ruoyi.bgt.service.IBgtProjectRecruitService; -import com.ruoyi.common.bo.AnnexQueryBo; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.BaseEntity; -import com.ruoyi.common.core.domain.entity.SysDictData; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.domain.Annex; -import com.ruoyi.common.service.IAnnexService; -import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.system.service.ISysDictTypeService; -import com.ruoyi.wgz.bo.res.*; -import com.ruoyi.wgz.bo.rests.WgzAppGetTestPaperThree; -import com.ruoyi.wgz.bo.rests.WgzAppGetTestPaperTwo; -import com.ruoyi.wgz.bo.rests.WgzAutonymAnnex; -import com.ruoyi.wgz.bo.req.*; -import com.ruoyi.wgz.domain.WgzDailyClock; -import com.ruoyi.wgz.domain.WgzPayCalculation; -import com.ruoyi.wgz.domain.WgzQuestionsConfiguration; -import com.ruoyi.wgz.service.*; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.var; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; + import com.ruoyi.bgt.domain.BgtProjectRecruit; + import com.ruoyi.bgt.domain.BgtProjectRecruitApply; + import com.ruoyi.bgt.domain.dto.BgtProjectRecruitQueryDTO; + import com.ruoyi.bgt.domain.vo.BgtProjectRecruitVO; + import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService; + import com.ruoyi.bgt.service.IBgtProjectRecruitService; + import com.ruoyi.common.bo.AnnexQueryBo; + import com.ruoyi.common.core.domain.AjaxResult; + import com.ruoyi.common.core.domain.BaseEntity; + import com.ruoyi.common.core.domain.entity.SysDictData; + import com.ruoyi.common.core.page.TableDataInfo; + import com.ruoyi.common.domain.Annex; + import com.ruoyi.common.service.IAnnexService; + import com.ruoyi.common.utils.SecurityUtils; + import com.ruoyi.system.service.ISysDictTypeService; + import com.ruoyi.wgz.bo.res.*; + import com.ruoyi.wgz.bo.rests.WgzAppGetTestPaperThree; + import com.ruoyi.wgz.bo.rests.WgzAppGetTestPaperTwo; + import com.ruoyi.wgz.bo.rests.WgzAutonymAnnex; + import com.ruoyi.wgz.bo.req.*; + import com.ruoyi.wgz.domain.WgzDailyClock; + import com.ruoyi.wgz.domain.WgzPayCalculation; + import com.ruoyi.wgz.domain.WgzQuestionsConfiguration; + import com.ruoyi.wgz.service.*; + import io.swagger.annotations.Api; + import io.swagger.annotations.ApiOperation; + import lombok.RequiredArgsConstructor; + import lombok.var; + import org.springframework.beans.BeanUtils; + import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.security.access.prepost.PreAuthorize; + import org.springframework.validation.annotation.Validated; + import org.springframework.web.bind.annotation.*; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static com.ruoyi.common.constant.Constants.WGZ; - -/** - * APP务工者Controller - * - * @author ruoyi - * @date 2025-02-14 - */ -@Api(value = "APP务工者接口", tags = {"务工者-APP接口"}) -@RequiredArgsConstructor(onConstructor_ = @Autowired) -@RestController - -@RequestMapping("/wgz/app") -public class WgzAppController { - - private final IWgzUserService iWgzUserService; - - @Autowired - private ISysDictTypeService dictTypeService; - - @Autowired - private IAnnexService iAnnexService; - - @Autowired - private IWgzQuestionBankService iWgzQuestionBankService; - - @Autowired - private IWgzQuestionsConfigurationService iWgzQuestionsConfigurationService; - - @Autowired - private IWgzQuestionSaveService iWgzQuestionSaveService; - - @Autowired - private IBgtProjectRecruitService iBgtProjectRecruitService; - - @Autowired - private IWgzDailyClockService iWgzDailyClockService; - - @Autowired - private IWgzLeaveService iWgzLeaveService; - - @Autowired - private IBgtProjectRecruitApplyService iBgtProjectRecruitApplyService; - - @Autowired - private IWgzAttendanceService iWgzAttendanceService; - - @Autowired - private IWgzReissueacardService iWgzReissueacardService; - - @Autowired - private IWgzPayCalculationService iWgzPayCalculationService; - - @Autowired - private IWgzMessageService iWgzMessageService; + import javax.validation.constraints.NotEmpty; + import javax.validation.constraints.NotNull; + import java.math.BigDecimal; + import java.time.LocalDate; + import java.time.LocalTime; + import java.util.ArrayList; + import java.util.HashMap; + import java.util.List; + import java.util.Map; + import static com.ruoyi.common.constant.Constants.WGZ; /** - * 【注册】务工者注册 + * APP务工者Controller + * + * @author ruoyi + * @date 2025-02-14 */ - @ApiOperation("【务工者账号注册】") - @PostMapping("/wgzRegister") - public AjaxResult userRegister(@Validated @RequestBody WgzAppRegisterReq bo) { - return AjaxResult.success(iWgzUserService.userRegister(bo)); - } + @Api(value = "APP务工者接口", tags = {"务工者-APP接口"}) + @RequiredArgsConstructor(onConstructor_ = @Autowired) + @RestController - /** - * 【首页】【首页界面】招工列表 - */ - @ApiOperation("【首页】【首页界面】招工列表") -// //@PreAuthorize("@ss.hasPermi('wgzApp:user:userJobListing')") - @GetMapping("/WgzUserJobListing") - public TableDataInfo userJobListing(@Validated WgzAppJobListingReq req) { - return iBgtProjectRecruitService.userJobListing(req); - } + @RequestMapping("/wgz/app") + public class WgzAppController { - /** - * 【我的】修改用户头像 - */ - @ApiOperation("【我的】修改用户头像") -// //@PreAuthorize("@ss.hasPermi('wgzApp:user:userModifyingUserProfilePicture')") - @PutMapping("/wgzUserModifyingUserProfilePicture") - public AjaxResult userModifyingUserProfilePicture(@Validated @RequestBody WgzAppModifyingUserProfilePictureReq req) { - return AjaxResult.success(iWgzUserService.userModifyingUserProfilePicture(req)); - } + private final IWgzUserService iWgzUserService; - /** - * 【我的】【个人基本信息】查询基础用户信息(还未带附件信息) - */ - @ApiOperation("【我的】个人基本信息(还未带附件信息)") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userPersonalBasicInformation')") - @GetMapping("/wgzUserPersonalBasicInformation") - public AjaxResult userPersonalBasicInformation(@Validated WgzAppPersonalBasicInformationReq req) { - return AjaxResult.success(iWgzUserService.userPersonalBasicInformation(req)); - } + @Autowired + private ISysDictTypeService dictTypeService; - /** - * 【我的】【实名认证】实名认证 - */ - @ApiOperation("【我的】实名认证") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userRealNameAuthentication')") - @PutMapping("/wgzUserRealNameAuthentication") - public AjaxResult userRealNameAuthentication(@Validated @RequestBody WgzAppRealNameAuthenticationReq req) { - return AjaxResult.success(iWgzUserService.userRealNameAuthentication(req)); - } + @Autowired + private IAnnexService iAnnexService; - /** - * 【我的】【岗前培训】获取安全教育考试试卷(随机获取) - */ - @ApiOperation("【我的】【岗前培训】岗前培训·获取随机试卷") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userGetTestPaper')") - @GetMapping("/WgzUserGetTestPaper") - public AjaxResult userGetTestPaper() { - //1、获取配置信息 - WgzQuestionsConfiguration configuration = iWgzQuestionsConfigurationService.appQueryLimitOne(); - if (configuration == null) { - throw new RuntimeException("未查询到配置信息"); + @Autowired + private IWgzQuestionBankService iWgzQuestionBankService; + + @Autowired + private IWgzQuestionsConfigurationService iWgzQuestionsConfigurationService; + + @Autowired + private IWgzQuestionSaveService iWgzQuestionSaveService; + + @Autowired + private IBgtProjectRecruitService iBgtProjectRecruitService; + + @Autowired + private IWgzDailyClockService iWgzDailyClockService; + + @Autowired + private IWgzLeaveService iWgzLeaveService; + + @Autowired + private IBgtProjectRecruitApplyService iBgtProjectRecruitApplyService; + + @Autowired + private IWgzAttendanceService iWgzAttendanceService; + + @Autowired + private IWgzReissueacardService iWgzReissueacardService; + + @Autowired + private IWgzPayCalculationService iWgzPayCalculationService; + + @Autowired + private IWgzMessageService iWgzMessageService; + + + /** + * 【注册】务工者注册 + */ + @ApiOperation("【务工者账号注册】") + @PostMapping("/wgzRegister") + public AjaxResult userRegister(@Validated @RequestBody WgzAppRegisterReq bo) { + return AjaxResult.success(iWgzUserService.userRegister(bo)); } - //2、随机获取数据,返回id和score - Integer s = configuration.getSingleChoice(); - Integer m = configuration.getMultipleChoice(); - Integer e = configuration.getEstimate(); - List sEntity = iWgzQuestionBankService.appQueryList(1, s); - List mEntity = iWgzQuestionBankService.appQueryList(2, m); - List eEntity = iWgzQuestionBankService.appQueryList(3, e); - //3、组装数据 - WgzAppGetTestPaperRes res = new WgzAppGetTestPaperRes(); - res.setSingleList(createQuestionSection("一、单选题", sEntity, configuration.getSingleScore(), s)); - res.setMultipleList(createQuestionSection("二、多选题", mEntity, configuration.getMultipleScore(), m)); - res.setEstimateList(createQuestionSection("三、判断题", eEntity, configuration.getEstimateScore(), e)); - //4、设置最大考试时间 - res.setMaximum(configuration.getAnswerTime()); - return AjaxResult.success(res); - } - /** - * 【我的】【岗前培训】提交用户的试卷(只保存最高分的试卷信息) - */ - @ApiOperation("【我的】【岗前培训】岗前培训·提交试卷") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userSubmitATestPaper')") - @PostMapping("/WgzUserSubmitATestPaper") - public AjaxResult userSubmitATestPaper(@Validated @RequestBody WgzAppSubmitATestPaperReq req) { - return AjaxResult.success(iWgzQuestionSaveService.userSubmitATestPaper(req)); - } - - /** - * 【我的】【请假】 历史请假列表 - */ - @ApiOperation("【我的】【请假】请假·历史请假列表") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userLeaveHistoryList')") - @GetMapping("/WgzAppUserLeaveHistoryListPage")//PageReq - public TableDataInfo userLeaveHistoryListPage(@Validated WgzAppLeaveHistoryListPageReq req) { - return iWgzLeaveService.userLeaveHistoryListPage(req); - } - - /** - * 【我的】【请假】 提交请假(上下班的时间需要等待zt创建好mysql字段) - */ - @ApiOperation("【我的】【请假】请假·提交请假(上下班的时间需要等待zt创建好mysql字段)") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userSubmitLeave')") - @PostMapping("/WgzAppSubmitLeave") - public AjaxResult userSubmitLeave(@Validated @RequestBody WgzAppSubmitLeaveReq req) { - return AjaxResult.success(iWgzLeaveService.userSubmitLeave(req)); - } - - /** - * 【我的】【请假】 取消请假 - */ - @ApiOperation("【我的】【请假】请假·取消请假") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userCancelLeave')") - @PutMapping("/WgzAppUserCancelLeave") - public AjaxResult userCancelLeave(@Validated @RequestBody WgzAppCancelLeaveReq req) { - return AjaxResult.success(iWgzLeaveService.userCancelLeave(req)); - } - - /** - * 【日报】日报日历 - */ - @ApiOperation("【日报】日报日历") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userDailyCalendar')") - @GetMapping("/WgzUserDailyCalendar") - public AjaxResult userDailyCalendar(@Validated WgzAppDailyCalendarReq req) { - WgzUserDailyCalendarRes wfzUserDailyCalendarRes = iWgzDailyClockService.userDailyCalendar(req); - return AjaxResult.success(wfzUserDailyCalendarRes); - } - - /** - * 【日报】日报打卡 - */ - @ApiOperation("【日报】日报打卡") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userDailyClock')") - @GetMapping("/WgzUserDailyClock") - public AjaxResult userDailyClock(@Validated WgzAppDailyClockReq req) { - return AjaxResult.success(iWgzDailyClockService.userDailyClock(req)); - } - - /** - * 【日报】日报日历·日报记录 - */ - @ApiOperation("【日报】【日报日历】日报日历·日报记录") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userDailyRecord')") - @GetMapping("/WgzUserDailyRecord") - public TableDataInfo userDailyRecord(@Validated WgzAppDailyRecordReq req) { - return iWgzDailyClockService.userDailyRecord(req); - } - - /** - * 【日报】日报日历·查看日报 - */ - @ApiOperation("【日报】【日报日历】日报日历·查看日报") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userCheckDailyNewspaper')") - @GetMapping("/WgzUserCheckDailyNewspaper/{id}") - public AjaxResult userCheckDailyNewspaper(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) { - return AjaxResult.success(iWgzDailyClockService.userCheckDailyNewspaper(id)); - } - - /** - * 【考勤打卡】【打卡】 提交上下班打卡·查看当前用户的打卡状态 - */ - @ApiOperation("【考勤打卡】【打卡】 提交上下班打卡·用户今日打卡状态") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userClockingCondition')") - @GetMapping("/WgzAppUserClockingCondition") - public AjaxResult userClockingCondition() { - return AjaxResult.success(iWgzAttendanceService.userClockingCondition()); - } - - /** - * 【考勤打卡】【打卡】 提交上下班打卡 - */ - @ApiOperation("【考勤打卡】【打卡】 提交上下班打卡)") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userSubmitTheClock')") - @PostMapping("/WgzAppUserSubmitTheClock") - public AjaxResult userSubmitTheClock(@Validated @RequestBody WgzAppSubmitTheClockReq req) { - return AjaxResult.success(iWgzAttendanceService.userSubmitTheClock(req)); - } - - /** - * 【考勤打卡】【打卡日历】 打卡日历记录 - */ - @ApiOperation("【考勤打卡】【打卡日历】 打卡日历记录") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userPunchTheCalendarRecord')") - @GetMapping("/WgzAppUserPunchTheCalendarRecord") - public AjaxResult userPunchTheCalendarRecord() { - return AjaxResult.success(iWgzAttendanceService.userPunchTheCalendarRecord()); - } - - /** - * 【考勤打卡】【打卡日历】 补卡申请列表 - */ - @ApiOperation("【考勤打卡】【打卡日历】 补卡申请列表") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userCardReplacementApplicationList')") - @GetMapping("/WgzAppUserCardReplacementApplicationList") - public AjaxResult userCardReplacementApplication() { - return AjaxResult.success(iWgzAttendanceService.userCardReplacementApplication()); - } - - /** - * 【考勤打卡】【打卡日历】 补卡申请 - */ - @ApiOperation("【考勤打卡】【打卡日历】 补卡申请)") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userCardReplacementApplication')") - @PostMapping("/WgzAppUserCardReplacementApplication") - public AjaxResult userCardReplacementApplication(@Validated @RequestBody WgzAppCardReplacementApplicationReq req) { - return AjaxResult.success(iWgzReissueacardService.userCardReplacementApplication(req)); - } - - /** - * 【考勤打卡】【打卡日历】 补卡记录 - */ - @ApiOperation("【考勤打卡】【打卡日历】 补卡记录)") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userReplacementCardRecord')") - @GetMapping("/WgzAppUserReplacementCardRecord") - public TableDataInfo userReplacementCardRecord(@Validated WgzAppReplacementCardRecordReq req) { - return iWgzReissueacardService.userReplacementCardRecord(req); - } - - /** - * 【首页】【项目详情】 项目详情 - */ - @ApiOperation("【首页】【招工列表】【项目详情】 项目详情)") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userProjectDetails')") - @GetMapping("/WgzAppUserProjectDetails/{id}") - public AjaxResult userProjectDetails(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) { - return AjaxResult.success(iBgtProjectRecruitService.userProjectDetails(id)); - } - - /** - * 【首页】【招工列表】【项目详情】 项目详情·申请报名(还未校验工种是否匹配工地岗位) - */ - @ApiOperation("【首页】【招工列表】【项目详情】 项目详情·申请报名)") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userApplyForRegistration')") - @GetMapping("/WgzAppUserApplyForRegistration/{id}") - public AjaxResult userApplyForRegistration(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) { - return AjaxResult.success(iBgtProjectRecruitApplyService.userApplyForRegistration(id)); - } - - /** - * 【首页】【已报名项目】 已报名项目 - */ - @ApiOperation("【首页】【已报名项目】 已报名项目") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userRegisteredProject')") - @GetMapping("/WgzAppUserRegisteredProject") - public TableDataInfo userRegisteredProject(@Validated WgzAppRegisteredProjectReq req) { - return iBgtProjectRecruitService.userRegisteredProject(req); - } - - /** - * 【首页】【已报名项目】 已报名项目·取消报名 - */ - @ApiOperation("【首页】【已报名项目】 已报名项目·取消报名)") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userCancelRegistration')") - @DeleteMapping("/WgzAppUserCancelRegistration/{recruitApplyId}") - public AjaxResult userCancelRegistration(@NotEmpty(message = "招工主键不能为空") @PathVariable Long recruitApplyId) { - return AjaxResult.success(iBgtProjectRecruitApplyService.userCancelRegistration(recruitApplyId)); - } - - /** - * 【首页】【已报名项目】 已报名项目·项目详情 - */ - @ApiOperation("【首页】【已报名项目】 已报名项目·项目详情") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userCancelRegistrationProjectDetails')") - @GetMapping("/WgzAppUserCancelRegistrationProjectDetails/{recruitId}") - public AjaxResult userCancelRegistrationProjectDetails(@NotEmpty(message = "招工主键不能为空") @PathVariable Long recruitId) { - return AjaxResult.success(iBgtProjectRecruitService.userCancelRegistrationProjectDetails(recruitId)); - } - - /** - * 【首页】【项目进行中】 项目进行中(分页,但是理论上这里始终只会有一条数据) - * 【首页】【已完成项目】 已完成项目 - */ - @ApiOperation("【首页】【项目进行中|已完成项目】 项目进行中") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userUnderway')") - @GetMapping("/WgzAppUserUnderway") - public TableDataInfo userUnderway(@Validated WgzAppUnderwayReq req) { - return iBgtProjectRecruitApplyService.userUnderway(req); - } - - /** - * 【首页】【项目进行中】 项目进行中·详情 - * 【首页】【已完成项目】 已完成项目·详情 - */ - @ApiOperation("【首页】【项目进行中|已完成项目】 详情") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userProjectInProgressDetails')") - @GetMapping("/WgzAppUserProjectInProgressDetails/{id}") - public AjaxResult userProjectInProgressDetails(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) { - WgzApplyForPayrollSettlementAddRes res = new WgzApplyForPayrollSettlementAddRes(); - Long appUserId = SecurityUtils.getAppUserId(); - BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId); - BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getRecruitId()); - //1、先获取项目详情基本信息 - WgzAppProjectDetailsRes wgzAppProjectDetailsRes = iBgtProjectRecruitService.userProjectDetails(id); - BeanUtils.copyProperties(wgzAppProjectDetailsRes, res); - //2、获取当前人员的打卡天数*单天金额=实际总工资金额 - BigDecimal recruitAmount = appById.getRecruitAmount(); - //查询实际考勤时间(只要有打卡就算出勤一条,异常也视为正常出勤,也就是说只要有上班or下班至少有一个有数据,那就证明出勤ok) - Integer i = iWgzAttendanceService.attendanceDetail(appUserId, appById.getId(), null); - if (i==0){ - res.setNum(0); - res.setTotalAmount(BigDecimal.valueOf(0)); - }else{ - BigDecimal totalAmount = recruitAmount.multiply(BigDecimal.valueOf(i)); - res.setNum(i); - res.setTotalAmount(totalAmount); + /** + * 【首页】【首页界面】招工列表 + */ + @ApiOperation("【首页】【首页界面】招工列表") + // //@PreAuthorize("@ss.hasPermi('wgzApp:user:userJobListing')") + @GetMapping("/WgzUserJobListing") + public TableDataInfo userJobListing(@Validated WgzAppJobListingReq req) { + return iBgtProjectRecruitService.userJobListing(req); } - res.setEntryTime(by.getEntryTime()). - setLeaveTime(by.getLeaveTime()). - setAmount(recruitAmount); - //3、查询当前进行中的项目是否有工资结算(多次追加) - List gzs = iWgzPayCalculationService.findByUserIdRecruitIdNewestData(appUserId, appById.getId()); - if (gzs.isEmpty()){ + + /** + * 【我的】修改用户头像 + */ + @ApiOperation("【我的】修改用户头像") + // //@PreAuthorize("@ss.hasPermi('wgzApp:user:userModifyingUserProfilePicture')") + @PutMapping("/wgzUserModifyingUserProfilePicture") + public AjaxResult userModifyingUserProfilePicture(@Validated @RequestBody WgzAppModifyingUserProfilePictureReq req) { + return AjaxResult.success(iWgzUserService.userModifyingUserProfilePicture(req)); + } + + /** + * 【我的】【个人基本信息】查询基础用户信息(还未带附件信息) + */ + @ApiOperation("【我的】个人基本信息(还未带附件信息)") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userPersonalBasicInformation')") + @GetMapping("/wgzUserPersonalBasicInformation") + public AjaxResult userPersonalBasicInformation(@Validated WgzAppPersonalBasicInformationReq req) { + return AjaxResult.success(iWgzUserService.userPersonalBasicInformation(req)); + } + + /** + * 【我的】【实名认证】实名认证 + */ + @ApiOperation("【我的】实名认证") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userRealNameAuthentication')") + @PutMapping("/wgzUserRealNameAuthentication") + public AjaxResult userRealNameAuthentication(@Validated @RequestBody WgzAppRealNameAuthenticationReq req) { + return AjaxResult.success(iWgzUserService.userRealNameAuthentication(req)); + } + + /** + * 【我的】【岗前培训】获取安全教育考试试卷(随机获取) + */ + @ApiOperation("【我的】【岗前培训】岗前培训·获取随机试卷") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userGetTestPaper')") + @GetMapping("/WgzUserGetTestPaper") + public AjaxResult userGetTestPaper() { + //1、获取配置信息 + WgzQuestionsConfiguration configuration = iWgzQuestionsConfigurationService.appQueryLimitOne(); + if (configuration == null) { + throw new RuntimeException("未查询到配置信息"); + } + //2、随机获取数据,返回id和score + Integer s = configuration.getSingleChoice(); + Integer m = configuration.getMultipleChoice(); + Integer e = configuration.getEstimate(); + List sEntity = iWgzQuestionBankService.appQueryList(1, s); + List mEntity = iWgzQuestionBankService.appQueryList(2, m); + List eEntity = iWgzQuestionBankService.appQueryList(3, e); + //3、组装数据 + WgzAppGetTestPaperRes res = new WgzAppGetTestPaperRes(); + res.setSingleList(createQuestionSection("一、单选题", sEntity, configuration.getSingleScore(), s)); + res.setMultipleList(createQuestionSection("二、多选题", mEntity, configuration.getMultipleScore(), m)); + res.setEstimateList(createQuestionSection("三、判断题", eEntity, configuration.getEstimateScore(), e)); + //4、设置最大考试时间 + res.setMaximum(configuration.getAnswerTime()); return AjaxResult.success(res); } - BigDecimal addSum = new BigDecimal(0); - for (WgzPayCalculation gz : gzs) { - //金额*天数=实际工资 - BigDecimal multiply = gz.getRecruitAmount().multiply(BigDecimal.valueOf(gz.getNum())); - addSum = addSum.add(multiply); + + /** + * 【我的】【岗前培训】提交用户的试卷(只保存最高分的试卷信息) + */ + @ApiOperation("【我的】【岗前培训】岗前培训·提交试卷") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userSubmitATestPaper')") + @PostMapping("/WgzUserSubmitATestPaper") + public AjaxResult userSubmitATestPaper(@Validated @RequestBody WgzAppSubmitATestPaperReq req) { + return AjaxResult.success(iWgzQuestionSaveService.userSubmitATestPaper(req)); } - res.setAppliedAmount(addSum); - res.setNameOfApplicant(gzs.get(0).getUserName()); - if(i!=0){ - //总的金额/结算的金额=百分比 - BigDecimal divide = res.getAppliedAmount().divide(res.getTotalAmount(), 2, BigDecimal.ROUND_HALF_UP); - res.setPercentage(divide.doubleValue()); + + /** + * 【我的】【请假】 历史请假列表 + */ + @ApiOperation("【我的】【请假】请假·历史请假列表") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userLeaveHistoryList')") + @GetMapping("/WgzAppUserLeaveHistoryListPage")//PageReq + public TableDataInfo userLeaveHistoryListPage(@Validated WgzAppLeaveHistoryListPageReq req) { + return iWgzLeaveService.userLeaveHistoryListPage(req); } - return AjaxResult.success(res); - } - /** - * 【首页】【项目进行中】 项目进行中·申请工资结算(新增) - * 【首页】【已完成项目】 已完成项目·申请工资结算(新增) - */ - @ApiOperation("【首页】【项目进行中|已完成项目】 申请工资结算(新增)") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userApplyForPayrollSettlementAdd')") - @PostMapping("/WgzAppUserApplyForPayrollSettlementAdd") - public AjaxResult userApplyForPayrollSettlementAdd(@Validated @RequestBody WgzApplyForPayrollSettlementAddReq req) { - return AjaxResult.success(iWgzPayCalculationService.userApplyForPayrollSettlementAdd(req)); - } + /** + * 【我的】【请假】 提交请假(上下班的时间需要等待zt创建好mysql字段) + */ + @ApiOperation("【我的】【请假】请假·提交请假(上下班的时间需要等待zt创建好mysql字段)") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userSubmitLeave')") + @PostMapping("/WgzAppSubmitLeave") + public AjaxResult userSubmitLeave(@Validated @RequestBody WgzAppSubmitLeaveReq req) { + return AjaxResult.success(iWgzLeaveService.userSubmitLeave(req)); + } - /** - * 【首页】【项目进行中】 项目进行中·申请工资结算(列表) - */ - @ApiOperation("【首页】【项目进行中】 项目进行中·申请工资结算(列表)") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userApplyForPayrollSettlementList')") - @GetMapping("/WgzAppUserApplyForPayrollSettlementList") - public TableDataInfo userApplyForPayrollSettlementList(@Validated WgzAppApplyForPayrollSettlementListReq req) { - return iWgzPayCalculationService.userApplyForPayrollSettlementList(req); - } + /** + * 【我的】【请假】 取消请假 + */ + @ApiOperation("【我的】【请假】请假·取消请假") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userCancelLeave')") + @PutMapping("/WgzAppUserCancelLeave") + public AjaxResult userCancelLeave(@Validated @RequestBody WgzAppCancelLeaveReq req) { + return AjaxResult.success(iWgzLeaveService.userCancelLeave(req)); + } - /** - * 【消息】消息类型统计 - */ - @ApiOperation("【消息】消息类型统计") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userMessageTypeStatistics')") - @GetMapping("/WgzAppUserMessageTypeStatistics") - public AjaxResult userMessageTypeStatistics() { - Long appUserId = SecurityUtils.getAppUserId(); - return AjaxResult.success(iWgzMessageService.userMessageTypeStatistics(appUserId)); - } + /** + * 【日报】日报日历 + */ + @ApiOperation("【日报】日报日历") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userDailyCalendar')") + @GetMapping("/WgzUserDailyCalendar") + public AjaxResult userDailyCalendar(@Validated WgzAppDailyCalendarReq req) { + WgzUserDailyCalendarRes wfzUserDailyCalendarRes = iWgzDailyClockService.userDailyCalendar(req); + return AjaxResult.success(wfzUserDailyCalendarRes); + } - /** - * 【消息】获取消息列表 - */ - @ApiOperation("【消息】获取消息列表") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userGetMessageList')") - @GetMapping("/WgzAppUserGetMessageList") - public TableDataInfo userGetMessageList(@Validated WgzAppGetMessageListReq req) { - return iWgzMessageService.userGetMessageList(req); - } + /** + * 【日报】日报打卡 + */ + @ApiOperation("【日报】日报打卡") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userDailyClock')") + @GetMapping("/WgzUserDailyClock") + public AjaxResult userDailyClock(@Validated WgzAppDailyClockReq req) { + return AjaxResult.success(iWgzDailyClockService.userDailyClock(req)); + } - /** - * 【消息】【报名消息】 报名消息 - */ - @ApiOperation("【消息】【报名消息】 报名消息") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userRegistrationInformation')") - @GetMapping("/WgzAppUserRegistrationInformation/{messageId}") - public AjaxResult userRegistrationInformation(@NotNull(message = "消息主键ID不能为空") @PathVariable("messageId") Long messageId) { - return AjaxResult.success(iWgzMessageService.userRegistrationInformation(messageId)); - } + /** + * 【日报】日报日历·日报记录 + */ + @ApiOperation("【日报】【日报日历】日报日历·日报记录") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userDailyRecord')") + @GetMapping("/WgzUserDailyRecord") + public TableDataInfo userDailyRecord(@Validated WgzAppDailyRecordReq req) { + return iWgzDailyClockService.userDailyRecord(req); + } - /** - * 【消息】【报名消息】 报名消息·确认|拒绝报名 - */ - @ApiOperation("【消息】【报名消息】 报名消息·确认|拒绝报名") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userConfirmRegistration')") - @PutMapping("/WgzAppUserConfirmRegistration") - public AjaxResult userConfirmRegistration(@Validated @RequestBody WgzAppConfirmRegistrationReq req) { - return AjaxResult.success(iBgtProjectRecruitApplyService.userConfirmRegistration(req)); - } + /** + * 【日报】日报日历·查看日报 + */ + @ApiOperation("【日报】【日报日历】日报日历·查看日报") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userCheckDailyNewspaper')") + @GetMapping("/WgzUserCheckDailyNewspaper/{id}") + public AjaxResult userCheckDailyNewspaper(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) { + return AjaxResult.success(iWgzDailyClockService.userCheckDailyNewspaper(id)); + } + /** + * 【考勤打卡】【打卡】 提交上下班打卡·查看当前用户的打卡状态 + */ + @ApiOperation("【考勤打卡】【打卡】 提交上下班打卡·用户今日打卡状态") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userClockingCondition')") + @GetMapping("/WgzAppUserClockingCondition") + public AjaxResult userClockingCondition() { + return AjaxResult.success(iWgzAttendanceService.userClockingCondition()); + } + /** + * 【考勤打卡】【打卡】 提交上下班打卡 + */ + @ApiOperation("【考勤打卡】【打卡】 提交上下班打卡)") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userSubmitTheClock')") + @PostMapping("/WgzAppUserSubmitTheClock") + public AjaxResult userSubmitTheClock(@Validated @RequestBody WgzAppSubmitTheClockReq req) { + return AjaxResult.success(iWgzAttendanceService.userSubmitTheClock(req)); + } + /** + * 【考勤打卡】【打卡日历】 打卡日历记录 + */ + @ApiOperation("【考勤打卡】【打卡日历】 打卡日历记录") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userPunchTheCalendarRecord')") + @GetMapping("/WgzAppUserPunchTheCalendarRecord") + public AjaxResult userPunchTheCalendarRecord() { + return AjaxResult.success(iWgzAttendanceService.userPunchTheCalendarRecord()); + } + /** + * 【考勤打卡】【打卡日历】 补卡申请列表 + */ + @ApiOperation("【考勤打卡】【打卡日历】 补卡申请列表") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userCardReplacementApplicationList')") + @GetMapping("/WgzAppUserCardReplacementApplicationList") + public AjaxResult userCardReplacementApplication() { + return AjaxResult.success(iWgzAttendanceService.userCardReplacementApplication()); + } + /** + * 【考勤打卡】【打卡日历】 补卡申请 + */ + @ApiOperation("【考勤打卡】【打卡日历】 补卡申请)") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userCardReplacementApplication')") + @PostMapping("/WgzAppUserCardReplacementApplication") + public AjaxResult userCardReplacementApplication(@Validated @RequestBody WgzAppCardReplacementApplicationReq req) { + return AjaxResult.success(iWgzReissueacardService.userCardReplacementApplication(req)); + } - /** - * 通用接口 - * ================================================================================================================= - * ================================================================================================================= - * ================================================================================================================= - */ + /** + * 【考勤打卡】【打卡日历】 补卡记录 + */ + @ApiOperation("【考勤打卡】【打卡日历】 补卡记录)") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userReplacementCardRecord')") + @GetMapping("/WgzAppUserReplacementCardRecord") + public TableDataInfo userReplacementCardRecord(@Validated WgzAppReplacementCardRecordReq req) { + return iWgzReissueacardService.userReplacementCardRecord(req); + } - /** - * 【我的】【实名认证】实名认证之务工者附件结构获取 - 0-资格证书 - * 【我的】【签协议】协议列表 - 1-劳动合同 - */ - @ApiOperation("【通用】附件获取(仅限和务工者直接关联的)") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userAttachmentAcquisition')") - @GetMapping("/wgzUserAttachmentAcquisition") - public AjaxResult userAttachmentAcquisition(@Validated WgzAppAttachmentAcquisitionReq req) { - Long appUserId = SecurityUtils.getAppUserId(); - Long recruitId; - if (req.getType()==1){ + /** + * 【首页】【项目详情】 项目详情 + */ + @ApiOperation("【首页】【招工列表】【项目详情】 项目详情)") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userProjectDetails')") + @GetMapping("/WgzAppUserProjectDetails/{id}") + public AjaxResult userProjectDetails(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) { + return AjaxResult.success(iBgtProjectRecruitService.userProjectDetails(id)); + } + + /** + * 【首页】【招工列表】【项目详情】 项目详情·申请报名(还未校验工种是否匹配工地岗位) + */ + @ApiOperation("【首页】【招工列表】【项目详情】 项目详情·申请报名)") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userApplyForRegistration')") + @GetMapping("/WgzAppUserApplyForRegistration/{id}") + public AjaxResult userApplyForRegistration(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) { + return AjaxResult.success(iBgtProjectRecruitApplyService.userApplyForRegistration(id)); + } + + /** + * 【首页】【已报名项目】 已报名项目 + */ + @ApiOperation("【首页】【已报名项目】 已报名项目") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userRegisteredProject')") + @GetMapping("/WgzAppUserRegisteredProject") + public TableDataInfo userRegisteredProject(@Validated WgzAppRegisteredProjectReq req) { + return iBgtProjectRecruitService.userRegisteredProject(req); + } + + /** + * 【首页】【已报名项目】 已报名项目·取消报名 + */ + @ApiOperation("【首页】【已报名项目】 已报名项目·取消报名)") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userCancelRegistration')") + @DeleteMapping("/WgzAppUserCancelRegistration/{recruitApplyId}") + public AjaxResult userCancelRegistration(@NotEmpty(message = "招工主键不能为空") @PathVariable Long recruitApplyId) { + return AjaxResult.success(iBgtProjectRecruitApplyService.userCancelRegistration(recruitApplyId)); + } + + /** + * 【首页】【已报名项目】 已报名项目·项目详情 + */ + @ApiOperation("【首页】【已报名项目】 已报名项目·项目详情") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userCancelRegistrationProjectDetails')") + @GetMapping("/WgzAppUserCancelRegistrationProjectDetails/{recruitId}") + public AjaxResult userCancelRegistrationProjectDetails(@NotEmpty(message = "招工主键不能为空") @PathVariable Long recruitId) { + return AjaxResult.success(iBgtProjectRecruitService.userCancelRegistrationProjectDetails(recruitId)); + } + + /** + * 【首页】【项目进行中】 项目进行中(分页,但是理论上这里始终只会有一条数据) + * 【首页】【已完成项目】 已完成项目 + */ + @ApiOperation("【首页】【项目进行中|已完成项目】 项目进行中") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userUnderway')") + @GetMapping("/WgzAppUserUnderway") + public TableDataInfo userUnderway(@Validated WgzAppUnderwayReq req) { + return iBgtProjectRecruitApplyService.userUnderway(req); + } + + /** + * 【首页】【项目进行中】 项目进行中·详情 + * 【首页】【已完成项目】 已完成项目·详情 + */ + @ApiOperation("【首页】【项目进行中|已完成项目】 详情") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userProjectInProgressDetails')") + @GetMapping("/WgzAppUserProjectInProgressDetails/{id}") + public AjaxResult userProjectInProgressDetails(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) { + WgzApplyForPayrollSettlementAddRes res = new WgzApplyForPayrollSettlementAddRes(); + Long appUserId = SecurityUtils.getAppUserId(); BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId); - recruitId = by.getRecruitId(); - if (!appUserId.equals(recruitId)){ - throw new RuntimeException("当前用户不是该招工的申请人"); + BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getRecruitId()); + //1、先获取项目详情基本信息 + WgzAppProjectDetailsRes wgzAppProjectDetailsRes = iBgtProjectRecruitService.userProjectDetails(id); + BeanUtils.copyProperties(wgzAppProjectDetailsRes, res); + //2、获取当前人员的打卡天数*单天金额=实际总工资金额 + BigDecimal recruitAmount = appById.getRecruitAmount(); + //查询实际考勤时间(只要有打卡就算出勤一条,异常也视为正常出勤,也就是说只要有上班or下班至少有一个有数据,那就证明出勤ok) + Integer i = iWgzAttendanceService.attendanceDetail(appUserId, appById.getId(), null); + if (i==0){ + res.setNum(0); + res.setTotalAmount(BigDecimal.valueOf(0)); + }else{ + BigDecimal totalAmount = recruitAmount.multiply(BigDecimal.valueOf(i)); + res.setNum(i); + res.setTotalAmount(totalAmount); } - } else { - recruitId = 0L; + res.setEntryTime(by.getEntryTime()). + setLeaveTime(by.getLeaveTime()). + setAmount(recruitAmount); + //3、查询当前进行中的项目是否有工资结算(多次追加) + List gzs = iWgzPayCalculationService.findByUserIdRecruitIdNewestData(appUserId, appById.getId()); + if (gzs.isEmpty()){ + return AjaxResult.success(res); + } + BigDecimal addSum = new BigDecimal(0); + for (WgzPayCalculation gz : gzs) { + //金额*天数=实际工资 + BigDecimal multiply = gz.getRecruitAmount().multiply(BigDecimal.valueOf(gz.getNum())); + addSum = addSum.add(multiply); + } + res.setAppliedAmount(addSum); + res.setNameOfApplicant(gzs.get(0).getUserName()); + if(i!=0){ + //总的金额/结算的金额=百分比 + BigDecimal divide = res.getAppliedAmount().divide(res.getTotalAmount(), 2, BigDecimal.ROUND_HALF_UP); + res.setPercentage(divide.doubleValue()); + } + return AjaxResult.success(res); } - //返回对象 - WgzAppAttachmentAcquisitionRes wgzAppAttachmentAcquisitionRes = new WgzAppAttachmentAcquisitionRes(); - List resData = new ArrayList<>(); - //附件类型 - String annexType = "wgz_attachment"; - //具体附件值 - List specifiedAttachment = req.getSpecifiedAttachment(); - //String[] SpecifiedAttachment = {"0"}; - //1、获取指定实名认证的附件结构返回 - List data = dictTypeService.selectDictDataByType(annexType); - for (SysDictData item : data) { - for (int i = 0; i < specifiedAttachment.size(); i++) { - String dictValue = item.getDictValue(); - String val = specifiedAttachment.get(i); - if (dictValue.equals(val)) { - //2、每个结构下有那些附件(附件可能有多个或一个);查询附件表 - AnnexQueryBo annexQueryBo = new AnnexQueryBo(); - annexQueryBo.setUserId(appUserId); - annexQueryBo.setUserType(WGZ); - if (req.getType()==1){ - annexQueryBo.setRecruitId(recruitId); + + /** + * 【首页】【项目进行中】 项目进行中·申请工资结算(新增) + * 【首页】【已完成项目】 已完成项目·申请工资结算(新增) + */ + @ApiOperation("【首页】【项目进行中|已完成项目】 申请工资结算(新增)") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userApplyForPayrollSettlementAdd')") + @PostMapping("/WgzAppUserApplyForPayrollSettlementAdd") + public AjaxResult userApplyForPayrollSettlementAdd(@Validated @RequestBody WgzApplyForPayrollSettlementAddReq req) { + return AjaxResult.success(iWgzPayCalculationService.userApplyForPayrollSettlementAdd(req)); + } + + /** + * 【首页】【项目进行中】 项目进行中·申请工资结算(列表) + */ + @ApiOperation("【首页】【项目进行中】 项目进行中·申请工资结算(列表)") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userApplyForPayrollSettlementList')") + @GetMapping("/WgzAppUserApplyForPayrollSettlementList") + public TableDataInfo userApplyForPayrollSettlementList(@Validated WgzAppApplyForPayrollSettlementListReq req) { + return iWgzPayCalculationService.userApplyForPayrollSettlementList(req); + } + + /** + * 【消息】消息类型统计 + */ + @ApiOperation("【消息】消息类型统计") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userMessageTypeStatistics')") + @GetMapping("/WgzAppUserMessageTypeStatistics") + public AjaxResult userMessageTypeStatistics() { + Long appUserId = SecurityUtils.getAppUserId(); + return AjaxResult.success(iWgzMessageService.userMessageTypeStatistics(appUserId)); + } + + /** + * 【消息】获取消息列表 + */ + @ApiOperation("【消息】获取消息列表") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userGetMessageList')") + @GetMapping("/WgzAppUserGetMessageList") + public TableDataInfo userGetMessageList(@Validated WgzAppGetMessageListReq req) { + return iWgzMessageService.userGetMessageList(req); + } + + /** + * 【消息】【报名消息】 报名消息 + */ + @ApiOperation("【消息】【报名消息】 报名消息") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userRegistrationInformation')") + @GetMapping("/WgzAppUserRegistrationInformation/{messageId}") + public AjaxResult userRegistrationInformation(@NotNull(message = "消息主键ID不能为空") @PathVariable("messageId") Long messageId) { + return AjaxResult.success(iWgzMessageService.userRegistrationInformation(messageId)); + } + + /** + * 【消息】【报名消息】 报名消息·确认|拒绝报名 + */ + @ApiOperation("【消息】【报名消息】 报名消息·确认|拒绝报名") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userConfirmRegistration')") + @PutMapping("/WgzAppUserConfirmRegistration") + public AjaxResult userConfirmRegistration(@Validated @RequestBody WgzAppConfirmRegistrationReq req) { + return AjaxResult.success(iBgtProjectRecruitApplyService.userConfirmRegistration(req)); + } + + + + + + + /** + * 通用接口 + * ================================================================================================================= + * ================================================================================================================= + * ================================================================================================================= + */ + + /** + * 【我的】【实名认证】实名认证之务工者附件结构获取 + 0-资格证书 + * 【我的】【签协议】协议列表 + 1-劳动合同 + */ + @ApiOperation("【通用】附件获取(仅限和务工者直接关联的)") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userAttachmentAcquisition')") + @GetMapping("/wgzUserAttachmentAcquisition") + public AjaxResult userAttachmentAcquisition(@Validated WgzAppAttachmentAcquisitionReq req) { + Long appUserId = SecurityUtils.getAppUserId(); + Long recruitId; + if (req.getType()==1){ + BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId); + recruitId = by.getRecruitId(); + if (!appUserId.equals(recruitId)){ + throw new RuntimeException("当前用户不是该招工的申请人"); + } + } else { + recruitId = 0L; + } + //返回对象 + WgzAppAttachmentAcquisitionRes wgzAppAttachmentAcquisitionRes = new WgzAppAttachmentAcquisitionRes(); + List resData = new ArrayList<>(); + //附件类型 + String annexType = "wgz_attachment"; + //具体附件值 + List specifiedAttachment = req.getSpecifiedAttachment(); + //String[] SpecifiedAttachment = {"0"}; + //1、获取指定实名认证的附件结构返回 + List data = dictTypeService.selectDictDataByType(annexType); + for (SysDictData item : data) { + for (int i = 0; i < specifiedAttachment.size(); i++) { + String dictValue = item.getDictValue(); + String val = specifiedAttachment.get(i); + if (dictValue.equals(val)) { + //2、每个结构下有那些附件(附件可能有多个或一个);查询附件表 + AnnexQueryBo annexQueryBo = new AnnexQueryBo(); + annexQueryBo.setUserId(appUserId); + annexQueryBo.setUserType(WGZ); + if (req.getType()==1){ + annexQueryBo.setRecruitId(recruitId); + } + annexQueryBo.setAnnexType(val); + List annexes = iAnnexService.queryList(annexQueryBo); + //3、具体附件结构 + WgzAutonymAnnex wgzAutonymAnnex = new WgzAutonymAnnex(). + setUserType(WGZ). + setDictLabel(item.getDictLabel()). + setDictValue(dictValue).setAnnex(annexes); + resData.add(wgzAutonymAnnex); } - annexQueryBo.setAnnexType(val); - List annexes = iAnnexService.queryList(annexQueryBo); - //3、具体附件结构 - WgzAutonymAnnex wgzAutonymAnnex = new WgzAutonymAnnex(). - setUserType(WGZ). - setDictLabel(item.getDictLabel()). - setDictValue(dictValue).setAnnex(annexes); - resData.add(wgzAutonymAnnex); } } + return AjaxResult.success(wgzAppAttachmentAcquisitionRes.setWgzAutonymAnnex(resData)); } - return AjaxResult.success(wgzAppAttachmentAcquisitionRes.setWgzAutonymAnnex(resData)); + + /** + * 【我的】【请假】 获取上下班时间 + * 【考勤打卡】【打卡】 获取上下班时间 + */ + @ApiOperation("【通用】获取上下班时间") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userGetCommutingTime')") + @GetMapping("/WgzAppUserGetCommutingTime")//PageReq + public AjaxResult> userGetCommutingTime() { + //1、获取当前人、当前工的上下班时间范围 + Long appUserId = SecurityUtils.getAppUserId(); + //2、根据唯一标识获取到当前用户的招工 + BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId); + //3、根据招工id获取到具体招工信息 + BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getRecruitId()); + Map mp = new HashMap<>(); + mp.put("beginWorkTime", appById.getBeginWorkTime()); + mp.put("endWorkTime", appById.getEndWorkTime()); + return AjaxResult.success(mp); + } + + /** + * 【消息】 + */ + @ApiOperation("【通用】修改已读未读状态") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userReadUnread')") + @PutMapping("/WgzAppUserReadUnread") + public AjaxResult userReadUnread(@Validated @RequestBody WgzAppReadUnreadReq req) { + return AjaxResult.success(iWgzMessageService.userReadUnread(req)); + } + + + + /** + * 控制层业务 + * ================================================================================================================= + * ================================================================================================================= + * ================================================================================================================= + */ + + /** + * 创建题目板块 + * @param topicPrefix 板块标题前缀 + * @param questions 题目列表 + * @param score 每题分数 + * @param questionCount 题目数量 + * @return 题目板块实体 + */ + private WgzAppGetTestPaperTwo createQuestionSection(String topicPrefix, List questions, Float score, int questionCount) { + WgzAppGetTestPaperTwo section = new WgzAppGetTestPaperTwo(); + section.setTopic(String.format("%s,共%d道题,每小题%.2f分,共计%.2f分", topicPrefix, questionCount, score, questionCount * score)); + questions.forEach(item -> item.setScore(score)); + section.setList(questions); + return section; + } + + /** + * 【我的】【实名认证】实名认证·删除附件 + */ + // @ApiOperation("APP务工者-实名认证·删除附件") + // //@PreAuthorize("@ss.hasPermi('wgzApp:user:userDeleteAttachment')") + // @DeleteMapping("/WgzUserDeleteAttachment/{attachmentId}") + // public AjaxResult userDeleteAttachment(@NotEmpty(message = "主键不能为空") @PathVariable Long attachmentId) { + // return AjaxResult.success(iAnnexService.deleteByIds(attachmentId)); + // } + + + /** + * 【首页】【项目进行中】 项目进行中·申请工资结算(查询) + */ + // @ApiOperation("【首页】【项目进行中】 项目进行中·申请工资结算(查询)") + // //@PreAuthorize("@ss.hasPermi('wgzApp:user:userApplyForPayrollSettlementFind')") + // @GetMapping("/WgzAppUserApplyForPayrollSettlementFind") + // public AjaxResult userApplyForPayrollSettlementFind(@Validated WgzApplyForPayrollSettlementFindReq req) { + // Long appUserId = SecurityUtils.getAppUserId(); + // BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId); + // BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getId()); + // //1、查询入场时间、退场时间、单天金额 + // BigDecimal recruitAmount = appById.getRecruitAmount(); + // //2、查询实际考勤时间(只要有打卡就算出勤一条,异常也视为正常出勤,也就是说只要有上班or下班至少有一个有数据,那就证明出勤ok) + // Integer i = iWgzAttendanceService.attendanceDetail(appUserId, appById.getId(), req.getNum()); + // if (i == 0){ + // throw new RuntimeException("您还未打卡"); + // } + // //3、单天金额*实际考勤总天数=实际工资 + // BigDecimal totalAmount = recruitAmount.multiply(BigDecimal.valueOf(i)); + // WgzApplyForPayrollSettlementFindRes res = new WgzApplyForPayrollSettlementFindRes(). + // setEntryTime(by.getEntryTime()). + // setLeaveTime(by.getLeaveTime()). + // setAmount(recruitAmount). + // setNum(i). + // setTotalAmount(totalAmount); + // return AjaxResult.success(res); + // } + } - - /** - * 【我的】【请假】 获取上下班时间 - * 【考勤打卡】【打卡】 获取上下班时间 - */ - @ApiOperation("【通用】获取上下班时间") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userGetCommutingTime')") - @GetMapping("/WgzAppUserGetCommutingTime")//PageReq - public AjaxResult> userGetCommutingTime() { - //1、获取当前人、当前工的上下班时间范围 - Long appUserId = SecurityUtils.getAppUserId(); - //2、根据唯一标识获取到当前用户的招工 - BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId); - //3、根据招工id获取到具体招工信息 - BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getRecruitId()); - Map mp = new HashMap<>(); - mp.put("beginWorkTime", appById.getBeginWorkTime()); - mp.put("endWorkTime", appById.getEndWorkTime()); - return AjaxResult.success(mp); - } - - /** - * 【消息】 - */ - @ApiOperation("【通用】修改已读未读状态") - //@PreAuthorize("@ss.hasPermi('wgzApp:user:userReadUnread')") - @PutMapping("/WgzAppUserReadUnread") - public AjaxResult userReadUnread(@Validated @RequestBody WgzAppReadUnreadReq req) { - return AjaxResult.success(iWgzMessageService.userReadUnread(req)); - } - - - - /** - * 控制层业务 - * ================================================================================================================= - * ================================================================================================================= - * ================================================================================================================= - */ - - /** - * 创建题目板块 - * @param topicPrefix 板块标题前缀 - * @param questions 题目列表 - * @param score 每题分数 - * @param questionCount 题目数量 - * @return 题目板块实体 - */ - private WgzAppGetTestPaperTwo createQuestionSection(String topicPrefix, List questions, Float score, int questionCount) { - WgzAppGetTestPaperTwo section = new WgzAppGetTestPaperTwo(); - section.setTopic(String.format("%s,共%d道题,每小题%.2f分,共计%.2f分", topicPrefix, questionCount, score, questionCount * score)); - questions.forEach(item -> item.setScore(score)); - section.setList(questions); - return section; - } - - /** - * 【我的】【实名认证】实名认证·删除附件 - */ -// @ApiOperation("APP务工者-实名认证·删除附件") -// //@PreAuthorize("@ss.hasPermi('wgzApp:user:userDeleteAttachment')") -// @DeleteMapping("/WgzUserDeleteAttachment/{attachmentId}") -// public AjaxResult userDeleteAttachment(@NotEmpty(message = "主键不能为空") @PathVariable Long attachmentId) { -// return AjaxResult.success(iAnnexService.deleteByIds(attachmentId)); -// } - - - /** - * 【首页】【项目进行中】 项目进行中·申请工资结算(查询) - */ -// @ApiOperation("【首页】【项目进行中】 项目进行中·申请工资结算(查询)") -// //@PreAuthorize("@ss.hasPermi('wgzApp:user:userApplyForPayrollSettlementFind')") -// @GetMapping("/WgzAppUserApplyForPayrollSettlementFind") -// public AjaxResult userApplyForPayrollSettlementFind(@Validated WgzApplyForPayrollSettlementFindReq req) { -// Long appUserId = SecurityUtils.getAppUserId(); -// BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId); -// BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getId()); -// //1、查询入场时间、退场时间、单天金额 -// BigDecimal recruitAmount = appById.getRecruitAmount(); -// //2、查询实际考勤时间(只要有打卡就算出勤一条,异常也视为正常出勤,也就是说只要有上班or下班至少有一个有数据,那就证明出勤ok) -// Integer i = iWgzAttendanceService.attendanceDetail(appUserId, appById.getId(), req.getNum()); -// if (i == 0){ -// throw new RuntimeException("您还未打卡"); -// } -// //3、单天金额*实际考勤总天数=实际工资 -// BigDecimal totalAmount = recruitAmount.multiply(BigDecimal.valueOf(i)); -// WgzApplyForPayrollSettlementFindRes res = new WgzApplyForPayrollSettlementFindRes(). -// setEntryTime(by.getEntryTime()). -// setLeaveTime(by.getLeaveTime()). -// setAmount(recruitAmount). -// setNum(i). -// setTotalAmount(totalAmount); -// return AjaxResult.success(res); -// } - -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitApplyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitApplyServiceImpl.java index 8f7d544..afeabb6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitApplyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitApplyServiceImpl.java @@ -524,7 +524,7 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl annex; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzMessageMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzMessageMapper.java index b5a53e0..fd5e644 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzMessageMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzMessageMapper.java @@ -11,6 +11,7 @@ import com.ruoyi.wgz.domain.WgzMessage; import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus; import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache; import org.apache.ibatis.annotations.CacheNamespace; +import org.apache.ibatis.annotations.Options; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -35,6 +36,7 @@ public interface WgzMessageMapper extends BaseMapperPlus { //分页查询消息列表 Page pagingQueryTheMessageList(@Param("page") Page page,@Param("req") WgzAppGetMessageListReq req); - @Select("SELECT count(1) FROM bgt_project_recruit_apply WHERE recruit_id = #{recruitId} and status in ('3','4')") - int countRecruitApply(Long recruitId); + @Select("SELECT count(1) FROM bgt_project_recruit_apply WHERE recruit_id = #{recruitId} and status in ('3','4') FOR UPDATE") + @Options(useCache = false) // 禁用 MyBatis 缓存 + int countRecruitApply(@Param("recruitId") Long recruitId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzMessageService.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzMessageService.java index 1869885..bbabfed 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzMessageService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzMessageService.java @@ -12,6 +12,7 @@ import com.ruoyi.common.core.mybatisplus.core.IServicePlus; import com.ruoyi.common.core.page.TableDataInfo; import org.springframework.validation.annotation.Validated; +import java.time.LocalDate; import java.util.Collection; import java.util.List; @@ -87,6 +88,11 @@ public interface IWgzMessageService extends IServicePlus { */ WgzAppRegistrationInformationRes userRegistrationInformation(Long messageId); + /** + * 判断招工是否已招满或已过期 + */ + String JudgingRecruitment(Long recruitId, int num, LocalDate recruitEndTime); + /** * 修改已读未读状态 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java index d815788..018d8bd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java @@ -160,16 +160,13 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl此处代码将改写逻辑为:每天凌晨1分的时候直接找出已请假的人然后定时插入数据到打卡记录中标记为请假 -// String formattedDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); -// WgzLeave wgzLeave = iWgzLeaveService.FindAskForLeaveOrNotInfo(appUserId, by.getId(), formattedDate); -// if (wgzLeave != null) { //表示有请假申请 -// LocalDateTime startTime = wgzLeave.getStartTime(); -// LocalDate localDate = startTime.toLocalDate(); -// throw new RuntimeException("您有已通过的请假申请,请假时间为:"+localDate); -// } //4、在进场时间时才能打卡,如果有退场记录就不允许打卡 - + if (by.getEntryTime() == null) { + throw new RuntimeException("需要进场才能实现打卡操作!"); + } + if (by.getLeaveTime() != null) { + throw new RuntimeException("您已离场,无法进行打卡操作!"); + } //5、查看当前人、当前工地、当天的打卡记录 String formattedDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); WgzAttendance we = publicFindByUserIdWait(appUserId, by.getRecruitId(), formattedDate); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzMessageServiceImpl.java index 35bd5d8..2721abd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzMessageServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzMessageServiceImpl.java @@ -36,6 +36,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.wgz.bo.WgzMessageQueryBo; import com.ruoyi.wgz.mapper.WgzMessageMapper; import com.ruoyi.wgz.service.IWgzMessageService; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; import java.util.*; @@ -228,14 +230,10 @@ public class WgzMessageServiceImpl extends ServicePlusImpllambdaQuery() -// .eq(BgtProjectRecruitApply::getRecruitId, recruitId) -// .in(BgtProjectRecruitApply::getStatus, Arrays.asList("3", "4")) -// ); if(count == num){ return "1"; } diff --git a/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitMapper.xml b/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitMapper.xml index 587e7f6..71d3ef3 100644 --- a/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitMapper.xml @@ -47,10 +47,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.*, b.task_name, b.task_address, - b.task_img + b.task_img, + d.dict_label AS typeOfWorkLabel FROM bgt_project_recruit as a LEFT JOIN fbs_project_task as b ON (a.task_id = b.id AND b.del_flag = 0) + LEFT JOIN sys_dict_data AS d ON ( d.dict_type = 'type_of_work' AND d.dict_value = a.type_of_work ) WHERE a.id = #{id} AND a.del_flag = 0 @@ -62,11 +64,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" c.task_name, c.task_address, c.task_img, + d.dict_label AS typeOfWorkLabel, (SELECT count(1) FROM bgt_project_recruit_apply WHERE recruit_id = b.id) as numberOfRegistered FROM bgt_project_recruit_apply as a LEFT JOIN bgt_project_recruit as b on(a.recruit_id = b.id and b.del_flag = 0 ) LEFT JOIN fbs_project_task as c ON (b.task_id = c.id AND c.del_flag = 0) + LEFT JOIN sys_dict_data AS d ON ( d.dict_type = 'type_of_work' AND d.dict_value = b.type_of_work ) WHERE a.user_id = #{userId} AND (a.status = '0' or a.status = '1') AND @@ -93,10 +97,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" c.task_name, c.task_address, c.task_img, + d.dict_label as typeOfWorkLabel, (SELECT count(1) FROM bgt_project_recruit_apply WHERE recruit_id = b.id) as numberOfRegistered FROM bgt_project_recruit as b LEFT JOIN fbs_project_task as c ON (c.id = b.task_id) + LEFT JOIN sys_dict_data as d ON (d.dict_type = 'type_of_work' and d.dict_value = b.type_of_work) WHERE DATE_FORMAT(NOW(), '%Y-%m-%d') BETWEEN b.recruit_begin_time AND b.recruit_end_time and b.id not in (SELECT recruit_id FROM bgt_project_recruit_apply WHERE user_id = #{req.userId})and diff --git a/ruoyi-system/src/main/resources/mapper/wgz/WgzMessageMapper.xml b/ruoyi-system/src/main/resources/mapper/wgz/WgzMessageMapper.xml index ff11255..df0c61f 100644 --- a/ruoyi-system/src/main/resources/mapper/wgz/WgzMessageMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wgz/WgzMessageMapper.xml @@ -132,6 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT a.id as recruitApplyId, a.entry_time as entryTime, + a.status as status, b.id as recruitId, b.create_time as createTime, b.recruit_name as recruitName, diff --git a/ruoyi/uploadPath/appResource/head/bgt.png b/ruoyi/uploadPath/appResource/head/bgt.png new file mode 100644 index 0000000..9b9c037 Binary files /dev/null and b/ruoyi/uploadPath/appResource/head/bgt.png differ diff --git a/ruoyi/uploadPath/appResource/head/fbs.png b/ruoyi/uploadPath/appResource/head/fbs.png new file mode 100644 index 0000000..3fd1bf1 Binary files /dev/null and b/ruoyi/uploadPath/appResource/head/fbs.png differ diff --git a/ruoyi/uploadPath/appResource/head/wgz.png b/ruoyi/uploadPath/appResource/head/wgz.png new file mode 100644 index 0000000..645ef3f Binary files /dev/null and b/ruoyi/uploadPath/appResource/head/wgz.png differ diff --git a/ruoyi/uploadPath/appResource/head/zbs.png b/ruoyi/uploadPath/appResource/head/zbs.png new file mode 100644 index 0000000..b956c53 Binary files /dev/null and b/ruoyi/uploadPath/appResource/head/zbs.png differ