diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtLeaveController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtLeaveController.java new file mode 100644 index 0000000..c1c36d4 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtLeaveController.java @@ -0,0 +1,52 @@ +package com.ruoyi.web.controller.bgt; + +import com.ruoyi.bgt.domain.dto.BgtLeaveUpdateDTO; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.wgz.domain.WgzLeave; +import com.ruoyi.wgz.service.IWgzLeaveService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.constraints.NotNull; + +/** + * 请假Controller + * + * @author ruoyi + * @date 2025-02-19 + */ +@Api(value = "App包工头请假控制器", tags = {"App包工头请假管理"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RestController +@RequestMapping("/app/bgt/leave") +public class AppBgtLeaveController extends BaseController { + + private final IWgzLeaveService iWgzLeaveService; + + /** + * 获取请假详细信息 + */ + @ApiOperation("获取请假详细信息") + @GetMapping("/{id}") + public AjaxResult getInfo(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { + return AjaxResult.success(iWgzLeaveService.queryById(id)); + } + + @ApiOperation("请假审核") + @Log(title = "请假审核", businessType = BusinessType.UPDATE) + @RepeatSubmit + @PutMapping() + public AjaxResult edit(@Validated @RequestBody BgtLeaveUpdateDTO dto) { + return AjaxResult.success(iWgzLeaveService.bgtAudit(dto)); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtMessageController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtMessageController.java index 3c55252..7e8cc5d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtMessageController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtMessageController.java @@ -3,9 +3,9 @@ package com.ruoyi.web.controller.bgt; import com.ruoyi.bgt.bo.BgtMessageQueryBo; import com.ruoyi.bgt.domain.BgtMessage; import com.ruoyi.bgt.domain.dto.BgtMessageMyListDTO; -import com.ruoyi.bgt.domain.dto.BgtMessageOtherDTO; +import com.ruoyi.bgt.domain.dto.BgtMessageDetailDTO; import com.ruoyi.bgt.domain.vo.BgtMessageCountVO; -import com.ruoyi.bgt.domain.vo.BgtMessageOtherVO; +import com.ruoyi.bgt.domain.vo.BgtMessageDetailVO; import com.ruoyi.bgt.domain.vo.BgtMessageVO; import com.ruoyi.bgt.service.IBgtMessageService; import com.ruoyi.common.annotation.Log; @@ -54,10 +54,10 @@ public class AppBgtMessageController extends BaseController { return iBgtMessageService.queryMyPageList(dto); } - @ApiOperation("其他消息列表") - @GetMapping("/otherList") - public TableDataInfo otherList(BgtMessageOtherDTO dto) { - return iBgtMessageService.queryOtherPageList(dto); + @ApiOperation("消息详情列表") + @GetMapping("/detailList") + public TableDataInfo otherList(BgtMessageDetailDTO dto) { + return iBgtMessageService.queryDetailPageList(dto); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectRecruitApplyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectRecruitApplyController.java index 686e8f8..5ce4a60 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectRecruitApplyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectRecruitApplyController.java @@ -47,7 +47,8 @@ public class AppBgtProjectRecruitApplyController extends BaseController { * * */ - @ApiOperation("App务工者列表(分页)") + @ApiOperation(value = "App务工者列表(分页)" + ,notes = "务工者申请列表 状态 为报名-未选择(0)和通过-已选择(1)") @GetMapping("/list") public TableDataInfo listPage(@Validated BgtProjectRecruitApplyQueryDTO dto) { return iBgtProjectRecruitApplyService.appQueryPageList(dto); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectRecruitController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectRecruitController.java index 22784d1..fbe224c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectRecruitController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectRecruitController.java @@ -3,6 +3,7 @@ package com.ruoyi.web.controller.bgt; import com.ruoyi.bgt.domain.BgtProjectRecruit; import com.ruoyi.bgt.domain.dto.BgtProjectRecruitQueryDTO; import com.ruoyi.bgt.domain.vo.BgtProjectRecruitDetailVO; +import com.ruoyi.bgt.domain.vo.BgtProjectRecruitDetailWgzListVO; import com.ruoyi.bgt.domain.vo.BgtProjectRecruitVO; import com.ruoyi.bgt.service.IBgtProjectRecruitService; import com.ruoyi.common.annotation.Log; @@ -37,7 +38,7 @@ public class AppBgtProjectRecruitController extends BaseController { /** * 查询包工头招工列表 状态为通过和报名 */ - @ApiOperation("我的招工") + @ApiOperation(value = "我的招工",notes = "1.查询包工头招工列表 状态为通过(1)和报名(0)") @GetMapping("/list") public TableDataInfo list(@Validated BgtProjectRecruitQueryDTO dto) { return iBgtProjectRecruitService.appQueryPageList(dto); @@ -53,6 +54,22 @@ public class AppBgtProjectRecruitController extends BaseController { return AjaxResult.success(iBgtProjectRecruitService.appQueryById(id)); } + @ApiOperation("我的招工任务详情-务工者申请列表") + @GetMapping("/wgzList/{id}") + public AjaxResult wgzList(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { + return AjaxResult.success(iBgtProjectRecruitService.wgzList(id)); + } + + @ApiOperation("务工者申请列表数量统计") + @GetMapping("/wgzCount/{id}") + public AjaxResult wgzCount(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { + BgtProjectRecruitDetailWgzListVO bgtProjectRecruitDetailWgzListVO = iBgtProjectRecruitService.wgzList(id); + bgtProjectRecruitDetailWgzListVO.setApplyList(null); + return AjaxResult.success(bgtProjectRecruitDetailWgzListVO); + } + /** * 新增包工头招工 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectTaskProgressController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectTaskProgressController.java index 3d27bee..29d6b43 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectTaskProgressController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/bgt/AppBgtProjectTaskProgressController.java @@ -61,8 +61,8 @@ public class AppBgtProjectTaskProgressController extends BaseController { @Log(title = "App上传任务进度", businessType = BusinessType.INSERT) @RepeatSubmit @PostMapping() - public AjaxResult add(@Validated @RequestBody BgtProjectTaskProgress bo) { - return toAjax(iBgtProjectTaskProgressService.insert(bo) ? 1 : 0); + public AjaxResult add(@Validated @RequestBody BgtProjectTaskProgress bo) { + return AjaxResult.success(iBgtProjectTaskProgressService.insert(bo)); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskController.java index 3ad8baa..a067225 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/fbs/AppFbsProjectTaskController.java @@ -38,7 +38,9 @@ public class AppFbsProjectTaskController extends BaseController { * 我的任务列表 任务状态 申请(0) 进行(1) 完成(2) 是否我的任务 true * */ - @ApiOperation("App包工头任务列表/我的任务") + @ApiOperation(value = "App包工头任务列表/我的任务" + ,notes = "1.首页任务列表 任务状态(status) 申请(0) 是否我的任务(myTask) false\n"+ + "2.我的任务列表 任务状态(status) 申请(0) 进行(1) 完成(2) 是否我的任务(myTask) true") @GetMapping("/list") public TableDataInfo list(@Validated AppTaskDTO dto) { return iFbsProjectTaskService.appQueryPageList(dto); diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtLeaveUpdateDTO.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtLeaveUpdateDTO.java new file mode 100644 index 0000000..970e00c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtLeaveUpdateDTO.java @@ -0,0 +1,33 @@ +package com.ruoyi.bgt.domain.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +/** + * 工资结算分页查询对象 wgz_pay_calculation + * + * @author ruoyi + * @date 2025-02-21 + */ + +@Data +@NoArgsConstructor +@Accessors(chain = true) +@ApiModel("包工头请假审核对象") +public class BgtLeaveUpdateDTO { + + @ApiModelProperty("主键自增ID") + private Long id; + + @ApiModelProperty("审核状态(0待审核 1审核中 2已同意 3已拒绝 4=已取消)") + private String auditorType; + + + @ApiModelProperty("审核意见") + private String auditorOpinion; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtMessageOtherDTO.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtMessageDetailDTO.java similarity index 75% rename from ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtMessageOtherDTO.java rename to ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtMessageDetailDTO.java index 24f86d4..3b87f0e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtMessageOtherDTO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/dto/BgtMessageDetailDTO.java @@ -8,7 +8,7 @@ import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import java.io.Serializable; -import java.time.LocalDateTime; +import java.time.LocalDate; /** * 消息对象 bgt_message @@ -20,7 +20,7 @@ import java.time.LocalDateTime; @NoArgsConstructor @Accessors(chain = true) @ApiModel("其他消息查询对象") -public class BgtMessageOtherDTO implements Serializable { +public class BgtMessageDetailDTO implements Serializable { private static final long serialVersionUID=1L; @@ -32,8 +32,11 @@ public class BgtMessageOtherDTO implements Serializable { private Integer pageNum; @ApiModelProperty("日期") - @JsonFormat(pattern = "yyyy-MM-dd hh", timezone = "GMT+8") - private LocalDateTime date; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private LocalDate date; + + @ApiModelProperty("大类型(字典bgt_message_large_type)") + private String messageLargeType; @ApiModelProperty("小类型(字典bgt_message_small_type)") private String messageSmallType; diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtMessageOtherVO.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtMessageDetailVO.java similarity index 94% rename from ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtMessageOtherVO.java rename to ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtMessageDetailVO.java index ca37623..28b23c1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtMessageOtherVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtMessageDetailVO.java @@ -20,7 +20,7 @@ import java.time.LocalDateTime; @NoArgsConstructor @Accessors(chain = true) @ApiModel("其他消息列表视图对象") -public class BgtMessageOtherVO implements Serializable { +public class BgtMessageDetailVO implements Serializable { private static final long serialVersionUID=1L; @@ -46,6 +46,7 @@ public class BgtMessageOtherVO implements Serializable { private String readStatus; @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") private LocalDateTime createTime; //补卡 diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitApplyVO.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitApplyVO.java index bb4cf84..7b95ba7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitApplyVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitApplyVO.java @@ -50,6 +50,9 @@ public class BgtProjectRecruitApplyVO implements Serializable { @ApiModelProperty("工种") private String typeOfWork; + @ApiModelProperty("招工ID") + private Long recruitId; + @ApiModelProperty("招工主题") private String recruitName; diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitDetailVO.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitDetailVO.java index a069f85..3e2a3c4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitDetailVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitDetailVO.java @@ -107,7 +107,7 @@ public class BgtProjectRecruitDetailVO implements Serializable { private LocalTime endWorkTime; @ApiModelProperty("申请者列表") - List applylist; + List applyList; @ApiModelProperty("总人数") private Integer totalNum; diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitDetailWgzListVO.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitDetailWgzListVO.java new file mode 100644 index 0000000..8af432d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitDetailWgzListVO.java @@ -0,0 +1,41 @@ +package com.ruoyi.bgt.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + * 包工头招工对象 bgt_project_recruit + * + * @author ruoyi + * @date 2025-02-17 + */ +@Data +@NoArgsConstructor +@Accessors(chain = true) +@ApiModel("App包工头招工详情-务工者申请列表对象") +public class BgtProjectRecruitDetailWgzListVO implements Serializable { + + private static final long serialVersionUID=1L; + + /** 主键ID */ + @ApiModelProperty("主键ID") + private Long id; + + @ApiModelProperty("申请者列表") + List applyList; + + @ApiModelProperty("总人数") + private Integer totalNum; + + @ApiModelProperty("同意人数") + private Integer passNum; + + @ApiModelProperty("未选择人数") + private Integer notSelectNum; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitVO.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitVO.java index 7e28f7b..25e90eb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/domain/vo/BgtProjectRecruitVO.java @@ -55,6 +55,6 @@ public class BgtProjectRecruitVO implements Serializable { private String typeOfWork; @ApiModelProperty("申请者列表") - List applylist; + List applyList; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/mapper/BgtMessageMapper.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/mapper/BgtMessageMapper.java index 6cc472c..e22d28c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/mapper/BgtMessageMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/mapper/BgtMessageMapper.java @@ -2,8 +2,8 @@ package com.ruoyi.bgt.mapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.bgt.domain.BgtMessage; -import com.ruoyi.bgt.domain.dto.BgtMessageOtherDTO; -import com.ruoyi.bgt.domain.vo.BgtMessageOtherVO; +import com.ruoyi.bgt.domain.dto.BgtMessageDetailDTO; +import com.ruoyi.bgt.domain.vo.BgtMessageDetailVO; import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache; import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus; import org.apache.ibatis.annotations.CacheNamespace; @@ -19,5 +19,5 @@ import org.apache.ibatis.annotations.Param; @CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class) public interface BgtMessageMapper extends BaseMapperPlus { - Page queryOtherPageList(@Param("page")Page page,@Param("dto") BgtMessageOtherDTO dto); + Page queryOtherPageList(@Param("page")Page page, @Param("dto") BgtMessageDetailDTO dto); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtMessageService.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtMessageService.java index eb88b6b..7c54be4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtMessageService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtMessageService.java @@ -3,9 +3,9 @@ package com.ruoyi.bgt.service; import com.ruoyi.bgt.bo.BgtMessageQueryBo; import com.ruoyi.bgt.domain.BgtMessage; import com.ruoyi.bgt.domain.dto.BgtMessageMyListDTO; -import com.ruoyi.bgt.domain.dto.BgtMessageOtherDTO; +import com.ruoyi.bgt.domain.dto.BgtMessageDetailDTO; import com.ruoyi.bgt.domain.vo.BgtMessageCountVO; -import com.ruoyi.bgt.domain.vo.BgtMessageOtherVO; +import com.ruoyi.bgt.domain.vo.BgtMessageDetailVO; import com.ruoyi.bgt.domain.vo.BgtMessageVO; import com.ruoyi.common.core.mybatisplus.core.IServicePlus; import com.ruoyi.common.core.page.TableDataInfo; @@ -81,7 +81,7 @@ public interface IBgtMessageService extends IServicePlus { TableDataInfo queryMyPageList(BgtMessageMyListDTO dto); /** - * 其他消息列表 + * 消息详情列表 */ - TableDataInfo queryOtherPageList(BgtMessageOtherDTO dto); + TableDataInfo queryDetailPageList(BgtMessageDetailDTO dto); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtProjectRecruitApplyService.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtProjectRecruitApplyService.java index cfad08a..59f7f12 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtProjectRecruitApplyService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/IBgtProjectRecruitApplyService.java @@ -10,8 +10,6 @@ import com.ruoyi.bgt.domain.vo.BgtProjectRecruitApplyVO; import com.ruoyi.common.core.mybatisplus.core.IServicePlus; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.wgz.bo.req.WgzAppConfirmRegistrationReq; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.RequestBody; import com.ruoyi.wgz.bo.req.WgzAppUnderwayReq; import com.ruoyi.wgz.bo.res.WgzAppUnderwayRes; import org.springframework.validation.annotation.Validated; @@ -107,6 +105,11 @@ public interface IBgtProjectRecruitApplyService extends IServicePlus getRecruitIdsByTaskId(Long taskId); + /** + * 获取任务下的所有招工Id和招工名称 + */ + Map getRecruitIdAndNameByTaskId(Long taskId); + /** * LC-APP相关 * ================================================================================================================= diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtMessageServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtMessageServiceImpl.java index 72a9853..32af16e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtMessageServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtMessageServiceImpl.java @@ -7,28 +7,41 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.bgt.bo.BgtMessageQueryBo; import com.ruoyi.bgt.domain.BgtMessage; +import com.ruoyi.bgt.domain.BgtProjectRecruit; +import com.ruoyi.bgt.domain.BgtProjectRecruitApply; +import com.ruoyi.bgt.domain.dto.BgtMessageDetailDTO; import com.ruoyi.bgt.domain.dto.BgtMessageMyListDTO; -import com.ruoyi.bgt.domain.dto.BgtMessageOtherDTO; -import com.ruoyi.bgt.domain.dto.BgtProjectRecruitApplyQueryDTO; -import com.ruoyi.bgt.domain.dto.BgtProjectRecruitQueryDTO; import com.ruoyi.bgt.domain.vo.BgtMessageCountVO; -import com.ruoyi.bgt.domain.vo.BgtMessageOtherVO; +import com.ruoyi.bgt.domain.vo.BgtMessageDetailVO; import com.ruoyi.bgt.domain.vo.BgtMessageVO; -import com.ruoyi.bgt.domain.vo.BgtProjectRecruitApplyVO; import com.ruoyi.bgt.mapper.BgtMessageMapper; import com.ruoyi.bgt.service.IBgtMessageService; +import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService; +import com.ruoyi.bgt.service.IBgtProjectRecruitService; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BgtMessageType; import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.wgz.domain.WgzLeave; +import com.ruoyi.wgz.domain.WgzPayCalculation; +import com.ruoyi.wgz.domain.WgzReissueacard; +import com.ruoyi.wgz.service.IWgzLeaveService; +import com.ruoyi.wgz.service.IWgzPayCalculationService; +import com.ruoyi.wgz.service.IWgzReissueacardService; +import com.ruoyi.wgz.service.IWgzUserService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.time.LocalTime; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import static com.ruoyi.common.constants.BgtMessageConstant.*; + /** * 消息Service业务层处理 * @@ -38,69 +51,87 @@ import java.util.stream.Collectors; @Service public class BgtMessageServiceImpl extends ServicePlusImpl implements IBgtMessageService { - @Override - public BgtMessage queryById(Long id){ - return getById(id); - } + @Autowired + private IBgtProjectRecruitApplyService recruitApplyService; - @Override - public TableDataInfo queryPageList(BgtMessageQueryBo bo) { - Page result = page(PageUtils.buildPage(), buildQueryWrapper(bo)); - return PageUtils.buildDataInfo(result); - } + @Autowired + private IBgtProjectRecruitService recruitService; - @Override - public List queryList(BgtMessageQueryBo bo) { - return list(buildQueryWrapper(bo)); - } + @Autowired + private IWgzPayCalculationService payCalculationService; - private LambdaQueryWrapper buildQueryWrapper(BgtMessageQueryBo bo) { - Map params = bo.getParams(); - LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); - lqw.eq(StrUtil.isNotBlank(bo.getSenderType()), BgtMessage::getSenderType, bo.getSenderType()); - lqw.eq(bo.getSenderId() != null, BgtMessage::getSenderId, bo.getSenderId()); - lqw.eq(StrUtil.isNotBlank(bo.getRecipientType()), BgtMessage::getRecipientType, bo.getRecipientType()); - lqw.eq(bo.getRecipientId() != null, BgtMessage::getRecipientId, bo.getRecipientId()); - lqw.eq(StrUtil.isNotBlank(bo.getHeadline()), BgtMessage::getHeadline, bo.getHeadline()); - lqw.eq(StrUtil.isNotBlank(bo.getSubheading()), BgtMessage::getSubheading, bo.getSubheading()); - lqw.eq(bo.getTableId() != null, BgtMessage::getTableId, bo.getTableId()); - lqw.like(StrUtil.isNotBlank(bo.getTableName()), BgtMessage::getTableName, bo.getTableName()); - lqw.eq(StrUtil.isNotBlank(bo.getMessageLargeType()), BgtMessage::getMessageLargeType, bo.getMessageLargeType()); - lqw.eq(StrUtil.isNotBlank(bo.getMessageSmallType()), BgtMessage::getMessageSmallType, bo.getMessageSmallType()); - lqw.eq(StrUtil.isNotBlank(bo.getReadStatus()), BgtMessage::getReadStatus, bo.getReadStatus()); - return lqw; - } + @Autowired + private IWgzLeaveService leaveService; - @Override - public Boolean insert(BgtMessage bo) { - BgtMessage add = BeanUtil.toBean(bo, BgtMessage.class); - validEntityBeforeSave(add); - return save(add); - } + @Autowired + private IWgzUserService wgzUserService; - @Override - public Boolean update(BgtMessage bo) { - BgtMessage update = BeanUtil.toBean(bo, BgtMessage.class); - validEntityBeforeSave(update); - return updateById(update); - } + @Autowired + private IWgzReissueacardService reissueacardService; - /** - * 保存前的数据校验 - * - * @param entity 实体类数据 - */ - private void validEntityBeforeSave(BgtMessage entity){ - //TODO 做一些数据校验,如唯一约束 - } + @Override + public BgtMessage queryById(Long id) { + return getById(id); + } - @Override - public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { - if(isValid){ - //TODO 做一些业务上的校验,判断是否需要校验 - } - return removeByIds(ids); - } + @Override + public TableDataInfo queryPageList(BgtMessageQueryBo bo) { + Page result = page(PageUtils.buildPage(), buildQueryWrapper(bo)); + return PageUtils.buildDataInfo(result); + } + + @Override + public List queryList(BgtMessageQueryBo bo) { + return list(buildQueryWrapper(bo)); + } + + private LambdaQueryWrapper buildQueryWrapper(BgtMessageQueryBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(StrUtil.isNotBlank(bo.getSenderType()), BgtMessage::getSenderType, bo.getSenderType()); + lqw.eq(bo.getSenderId() != null, BgtMessage::getSenderId, bo.getSenderId()); + lqw.eq(StrUtil.isNotBlank(bo.getRecipientType()), BgtMessage::getRecipientType, bo.getRecipientType()); + lqw.eq(bo.getRecipientId() != null, BgtMessage::getRecipientId, bo.getRecipientId()); + lqw.eq(StrUtil.isNotBlank(bo.getHeadline()), BgtMessage::getHeadline, bo.getHeadline()); + lqw.eq(StrUtil.isNotBlank(bo.getSubheading()), BgtMessage::getSubheading, bo.getSubheading()); + lqw.eq(bo.getTableId() != null, BgtMessage::getTableId, bo.getTableId()); + lqw.like(StrUtil.isNotBlank(bo.getTableName()), BgtMessage::getTableName, bo.getTableName()); + lqw.eq(StrUtil.isNotBlank(bo.getMessageLargeType()), BgtMessage::getMessageLargeType, bo.getMessageLargeType()); + lqw.eq(StrUtil.isNotBlank(bo.getMessageSmallType()), BgtMessage::getMessageSmallType, bo.getMessageSmallType()); + lqw.eq(StrUtil.isNotBlank(bo.getReadStatus()), BgtMessage::getReadStatus, bo.getReadStatus()); + return lqw; + } + + @Override + public Boolean insert(BgtMessage bo) { + BgtMessage add = BeanUtil.toBean(bo, BgtMessage.class); + validEntityBeforeSave(add); + return save(add); + } + + @Override + public Boolean update(BgtMessage bo) { + BgtMessage update = BeanUtil.toBean(bo, BgtMessage.class); + validEntityBeforeSave(update); + return updateById(update); + } + + /** + * 保存前的数据校验 + * + * @param entity 实体类数据 + */ + private void validEntityBeforeSave(BgtMessage entity) { + //TODO 做一些数据校验,如唯一约束 + } + + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if (isValid) { + //TODO 做一些业务上的校验,判断是否需要校验 + } + return removeByIds(ids); + } /** * LC-APP相关 @@ -122,9 +153,9 @@ public class BgtMessageServiceImpl extends ServicePlusImpl map = bgtMessages.stream().collect(Collectors.groupingBy(BgtMessage::getMessageLargeType, Collectors.counting())); BgtMessageCountVO bgtMessageCountVO = new BgtMessageCountVO(); - bgtMessageCountVO.setTaskMessageCount(map.getOrDefault(BgtMessageType.TASK.getCode(),0L).intValue()); - bgtMessageCountVO.setSettlementMessageCount(map.getOrDefault(BgtMessageType.SETTLEMENT.getCode(),0L).intValue()); - bgtMessageCountVO.setOtherMessageCount(map.getOrDefault(BgtMessageType.OTHER.getCode(),0L).intValue()); + bgtMessageCountVO.setTaskMessageCount(map.getOrDefault(BgtMessageType.TASK.getCode(), 0L).intValue()); + bgtMessageCountVO.setSettlementMessageCount(map.getOrDefault(BgtMessageType.SETTLEMENT.getCode(), 0L).intValue()); + bgtMessageCountVO.setOtherMessageCount(map.getOrDefault(BgtMessageType.OTHER.getCode(), 0L).intValue()); return bgtMessageCountVO; } @@ -135,16 +166,62 @@ public class BgtMessageServiceImpl extends ServicePlusImpl result = page(PageUtils.buildPage(), wrapper); Page bgtMessageVOPage = new Page<>(); bgtMessageVOPage.setTotal(result.getTotal()); - bgtMessageVOPage.setRecords(BeanUtil.copyToList(result.getRecords(),BgtMessageVO.class)); + bgtMessageVOPage.setRecords(BeanUtil.copyToList(result.getRecords(), BgtMessageVO.class)); return PageUtils.buildDataInfo(bgtMessageVOPage); } @Override - public TableDataInfo queryOtherPageList(BgtMessageOtherDTO dto) { - Page queryDTOPage = new Page<>(); - queryDTOPage.setCurrent(dto.getPageNum()); - queryDTOPage.setSize(dto.getPageSize()); - Page queryVOPage = baseMapper.queryOtherPageList(queryDTOPage, dto); - return PageUtils.buildDataInfo(queryVOPage); + public TableDataInfo queryDetailPageList(BgtMessageDetailDTO dto) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(BgtMessage::getRecipientId, SecurityUtils.getAppUserId()); + wrapper.eq(StrUtil.isNotBlank(dto.getMessageLargeType()), BgtMessage::getMessageLargeType, dto.getMessageLargeType()); + wrapper.eq(StrUtil.isNotBlank(dto.getMessageSmallType()), BgtMessage::getMessageSmallType, dto.getMessageSmallType()); + wrapper.between(dto.getDate() != null, BgtMessage::getCreateTime, dto.getDate().atStartOfDay(), dto.getDate().atStartOfDay().with(LocalTime.MAX)); + Page result = page(PageUtils.buildPage(), wrapper); + Page bgtMessageVOPage = new Page<>(); + bgtMessageVOPage.setTotal(result.getTotal()); + + ArrayList bgtMessageVOS = new ArrayList<>(); + + for (BgtMessage message : result.getRecords()) { + BgtMessageDetailVO bgtMessageDetailVO = BeanUtil.copyProperties(message, BgtMessageDetailVO.class); + if (BGT_LARGE_TASK.equals(message.getMessageLargeType())) { + // todo + } else if (BGT_LARGE_SETTLEMENT.equals(message.getMessageLargeType())) { + // todo + } else if (BGT_LARGE_OTHER.equals(message.getMessageLargeType())) { + + switch (message.getMessageSmallType()) { + case BGT_SMALL_SIGN_UP: + BgtProjectRecruitApply recruitApply = recruitApplyService.getById(message.getTableId()); + BgtProjectRecruit recruit = recruitService.getById(recruitApply.getRecruitId()); + bgtMessageDetailVO.setRecruitName(recruit.getRecruitName()); + break; + case BGT_SMALL_PAY: + WgzPayCalculation payCalculation = payCalculationService.getById(message.getTableId()); + BgtProjectRecruit recruitPay = recruitService.getById(payCalculation.getRecruitId()); + bgtMessageDetailVO.setRecruitName(recruitPay.getRecruitName()); + break; + case BGT_SMALL_LEAVE: + WgzLeave wgzLeave = leaveService.getById(message.getTableId()); + bgtMessageDetailVO.setReason(wgzLeave.getReason()); + bgtMessageDetailVO.setUsername(wgzUserService.getById(wgzLeave.getUserId()).getUsername()); + bgtMessageDetailVO.setStartTime(wgzLeave.getStartTime()); + bgtMessageDetailVO.setEndTime(wgzLeave.getEndTime()); + break; + case BGT_SMALL_MAKE_UP: + WgzReissueacard reissueacard = reissueacardService.getById(message.getTableId()); + bgtMessageDetailVO.setReason(reissueacard.getReason()); + bgtMessageDetailVO.setUsername(wgzUserService.getById(reissueacard.getUserId()).getUsername()); + bgtMessageDetailVO.setNowTime(reissueacard.getNowTime()); + break; + default: + break; + } + bgtMessageVOS.add(bgtMessageDetailVO); + } + } + bgtMessageVOPage.setRecords(bgtMessageVOS); + return PageUtils.buildDataInfo(bgtMessageVOPage); } } 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 671d457..35c9c04 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 @@ -3,6 +3,7 @@ package com.ruoyi.bgt.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; @@ -10,13 +11,15 @@ import com.ruoyi.bgt.bo.BgtProjectRecruitApplyQueryBo; import com.ruoyi.bgt.domain.BgtMessage; import com.ruoyi.bgt.domain.BgtProjectRecruit; import com.ruoyi.bgt.domain.BgtProjectRecruitApply; -import com.ruoyi.bgt.domain.dto.*; +import com.ruoyi.bgt.domain.dto.BgtAttendanceDayDTO; +import com.ruoyi.bgt.domain.dto.BgtProjectRecruitApplyConsentDTO; +import com.ruoyi.bgt.domain.dto.BgtProjectRecruitApplyQueryDTO; +import com.ruoyi.bgt.domain.dto.BgtScoreDTO; import com.ruoyi.bgt.domain.vo.BgtProjectRecruitApplyVO; import com.ruoyi.bgt.mapper.BgtProjectRecruitApplyMapper; import com.ruoyi.bgt.service.IBgtMessageService; import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService; import com.ruoyi.bgt.service.IBgtProjectRecruitService; -import com.ruoyi.common.constants.WgzAndBgtMessageConstant; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.page.TableDataInfo; @@ -37,6 +40,8 @@ import com.ruoyi.wgz.service.IWgzMessageService; import com.ruoyi.wgz.service.IWgzScoreRecordService; import com.ruoyi.wgz.service.IWgzUserService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -44,6 +49,7 @@ import java.text.DecimalFormat; import java.time.LocalDate; import java.util.*; +import static com.ruoyi.common.constants.BgtMessageConstant.*; import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*; /** @@ -62,78 +68,79 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl queryPageList(BgtProjectRecruitApplyQueryBo bo) { - Page result = page(PageUtils.buildPage(), buildQueryWrapper(bo)); - return PageUtils.buildDataInfo(result); - } + @Override + public TableDataInfo queryPageList(BgtProjectRecruitApplyQueryBo bo) { + Page result = page(PageUtils.buildPage(), buildQueryWrapper(bo)); + return PageUtils.buildDataInfo(result); + } - @Override - public List queryList(BgtProjectRecruitApplyQueryBo bo) { - return list(buildQueryWrapper(bo)); - } + @Override + public List queryList(BgtProjectRecruitApplyQueryBo bo) { + return list(buildQueryWrapper(bo)); + } - private LambdaQueryWrapper buildQueryWrapper(BgtProjectRecruitApplyQueryBo bo) { - Map params = bo.getParams(); - LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); - lqw.eq(bo.getRecruitId() != null, BgtProjectRecruitApply::getRecruitId, bo.getRecruitId()); - lqw.eq(bo.getUserId() != null, BgtProjectRecruitApply::getUserId, bo.getUserId()); - return lqw; - } + private LambdaQueryWrapper buildQueryWrapper(BgtProjectRecruitApplyQueryBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getRecruitId() != null, BgtProjectRecruitApply::getRecruitId, bo.getRecruitId()); + lqw.eq(bo.getUserId() != null, BgtProjectRecruitApply::getUserId, bo.getUserId()); + return lqw; + } - @Override - public Boolean insert(BgtProjectRecruitApply bo) { - BgtProjectRecruitApply add = BeanUtil.toBean(bo, BgtProjectRecruitApply.class); - validEntityBeforeSave(add); - return save(add); - } + @Override + public Boolean insert(BgtProjectRecruitApply bo) { + BgtProjectRecruitApply add = BeanUtil.toBean(bo, BgtProjectRecruitApply.class); + validEntityBeforeSave(add); + return save(add); + } - @Override - public Boolean update(BgtProjectRecruitApply bo) { - BgtProjectRecruitApply update = BeanUtil.toBean(bo, BgtProjectRecruitApply.class); - validEntityBeforeSave(update); - return updateById(update); - } + @Override + public Boolean update(BgtProjectRecruitApply bo) { + BgtProjectRecruitApply update = BeanUtil.toBean(bo, BgtProjectRecruitApply.class); + validEntityBeforeSave(update); + return updateById(update); + } - /** - * 保存前的数据校验 - * - * @param entity 实体类数据 - */ - private void validEntityBeforeSave(BgtProjectRecruitApply entity){ - //TODO 做一些数据校验,如唯一约束 - } + /** + * 保存前的数据校验 + * + * @param entity 实体类数据 + */ + private void validEntityBeforeSave(BgtProjectRecruitApply entity) { + //TODO 做一些数据校验,如唯一约束 + } - @Override - public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { - if(isValid){ - //TODO 做一些业务上的校验,判断是否需要校验 - } - return removeByIds(ids); - } + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if (isValid) { + //TODO 做一些业务上的校验,判断是否需要校验 + } + return removeByIds(ids); + } @Override public TableDataInfo appQueryPageList(BgtProjectRecruitApplyQueryDTO dto) { - if(dto.getTaskId()!=null){ + if (dto.getTaskId() != null) { List recruitIdsByTaskId = iBgtProjectRecruitService.getRecruitIdsByTaskId(dto.getTaskId()); - if(dto.getRecruitIds()==null){ + if (dto.getRecruitIds() == null) { dto.setRecruitIds(recruitIdsByTaskId); - }else { + } else { dto.getRecruitIds().addAll(recruitIdsByTaskId); } } @@ -147,6 +154,14 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl appQueryList(BgtProjectRecruitApplyQueryDTO dto) { + if (dto.getTaskId() != null) { + List recruitIdsByTaskId = iBgtProjectRecruitService.getRecruitIdsByTaskId(dto.getTaskId()); + if (dto.getRecruitIds() == null) { + dto.setRecruitIds(recruitIdsByTaskId); + } else { + dto.getRecruitIds().addAll(recruitIdsByTaskId); + } + } return baseMapper.appQueryList(dto); } @@ -160,7 +175,7 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl mp = new HashMap<>(); - mp.put("projectName",iBgtProjectRecruitService.getById(recruitApply.getRecruitId()).getRecruitName()); - mp.put("auditor",SecurityUtils.getUsername()); + mp.put("projectName", iBgtProjectRecruitService.getById(recruitApply.getRecruitId()).getRecruitName()); + mp.put("auditor", SecurityUtils.getUsername()); Map map = bgtMessage(mp, BGT_TYPE_SIGN_UP, true); WgzMessage wgzMessage = new WgzMessage() .setSenderType(USERTYPE_BGT) @@ -185,13 +200,11 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl lqw = Wrappers.lambdaQuery(); lqw.eq(BgtProjectRecruitApply::getUserId, id). in(BgtProjectRecruitApply::getStatus, strings); //包工头+务工者同意 or 进场 才算进场ok List bgtProjectRecruitApplies = baseMapper.selectList(lqw); - if (bgtProjectRecruitApplies.isEmpty()){ + if (bgtProjectRecruitApplies.isEmpty()) { throw new RuntimeException("异常,还未查询到您进入了工地!"); } - if (bgtProjectRecruitApplies.size()>1){ + if (bgtProjectRecruitApplies.size() > 1) { throw new RuntimeException("异常,查询到用户同时在多个工地务工!"); } return bgtProjectRecruitApplies.get(0); @@ -228,23 +241,23 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl(). - eq(BgtProjectRecruitApply::getUserId, appUserId). - in(BgtProjectRecruitApply::getStatus, "3","5") + eq(BgtProjectRecruitApply::getUserId, appUserId). + in(BgtProjectRecruitApply::getStatus, "3", "5") ); - if (i>0){ + if (i > 0) { throw new RuntimeException("已有工地!不可再次申请!"); } WgzUser byId = wgzUserService.findByUserId(appUserId); - if (!Objects.equals(appById.getTypeOfWork(), byId.getTypeOfWork())){ + if (!Objects.equals(appById.getTypeOfWork(), byId.getTypeOfWork())) { throw new RuntimeException("工种不匹配!"); } //4、判断当前用户是否已经申请过了,如果已经申请过了,就不能再次申请了 Integer integer = baseMapper.selectCount( new LambdaQueryWrapper(). - eq(BgtProjectRecruitApply::getUserId, appUserId). - eq(BgtProjectRecruitApply::getRecruitId, id) + eq(BgtProjectRecruitApply::getUserId, appUserId). + eq(BgtProjectRecruitApply::getRecruitId, id) ); - if (integer>0){ + if (integer > 0) { throw new RuntimeException("已申请过了!不可再次申请!"); } //3、插入数据 @@ -253,24 +266,24 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl0){ + if (insert > 0) { SysDictData typeOfWork = dictTypeService.selectDictDataByTypeAndData("type_of_work", byId.getTypeOfWork()); Map mp = new HashMap<>(); - mp.put("projectName",appById.getRecruitName()); - mp.put("userName",byId.getUsername()); - mp.put("post",typeOfWork.getDictLabel()); + mp.put("projectName", appById.getRecruitName()); + mp.put("userName", byId.getUsername()); + mp.put("post", typeOfWork.getDictLabel()); //4-1、系统发送消息给当前用户 WgzMessage wgzMessage = new WgzMessage(). setSenderType(USERTYPE_SYSTEM). setRecipientType(USERTYPE_WGZ). setRecipientId(appUserId). - setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"101")). - setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"102")). + setHeadline(wgzMessage(mp, "101")). + setSubheading(wgzMessage(mp, "102")). setTableId(bgtProjectRecruitApply.getId()). setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()). setMessageLargeType(LARGE_OTHER). setMessageSmallType(SMALL_SYSTEM); - if (!iWgzMessageService.sendAMessage(wgzMessage)){ + if (!iWgzMessageService.sendAMessage(wgzMessage)) { throw new RuntimeException("系统消息发送失败!"); } //4-2、当前用户发送消息给包工头 @@ -279,29 +292,90 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl todayAttendanceList(BgtAttendanceDayDTO dto){ + public List todayAttendanceList(BgtAttendanceDayDTO dto) { return baseMapper.todayAttendanceList(dto); } @Override + @Transactional(rollbackFor = Exception.class) public Boolean quit(Long id) { - return super.lambdaUpdate().eq(BgtProjectRecruitApply::getId, id) - .set(BgtProjectRecruitApply::getLeaveTime, LocalDate.now()) - .set(BgtProjectRecruitApply::getStatus, RecruitApplyStatus.OUT_WORK.getCode()) - .update(); + BgtProjectRecruitApply recruitApply = getById(id); + BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(recruitApply.getRecruitId()); + + //发消息 + HashMap mp = new HashMap<>(); + mp.put("projectName", recruit.getRecruitName()); + mp.put("auditor", SecurityUtils.getUsername()); + Map map = bgtMessage(mp, BGT_TYPE_EXIT, true); + WgzMessage wgzMessage = new WgzMessage() + .setSenderType(USERTYPE_BGT) + .setRecipientType(USERTYPE_WGZ) + .setRecipientId(recruitApply.getUserId()) + .setHeadline(map.get(HEADLINE)) + .setSubheading(map.get(SUBHEADING)) + .setTableId(recruitApply.getId()) + .setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()) + .setMessageLargeType(LARGE_OTHER) + .setMessageSmallType(SMALL_EXIT); + iWgzMessageService.sendAMessage(wgzMessage); + + recruitApply.setStatus(RecruitApplyStatus.OUT_WORK.getCode()); + recruitApply.setLeaveTime(LocalDate.now()); + + return updateById(recruitApply); + } + + @Async + @Override + public void quitBatch(Long taskId) { + BgtProjectRecruitApplyQueryDTO dto = new BgtProjectRecruitApplyQueryDTO(); + dto.setTaskId(taskId); + dto.setStatus(Collections.singletonList(RecruitApplyStatus.WORKING.getCode())); + List bgtProjectRecruitApplyVOS = appQueryList(dto); + + if (CollectionUtil.isNotEmpty(bgtProjectRecruitApplyVOS)) { + //发消息 + List wgzMessages = new ArrayList<>(); + List ids = new ArrayList<>(); + for (BgtProjectRecruitApplyVO vo : bgtProjectRecruitApplyVOS) { + ids.add(vo.getId()); + HashMap mp = new HashMap<>(); + mp.put("projectName", vo.getRecruitName()); + mp.put("auditor", "系统"); + Map map = bgtMessage(mp, BGT_TYPE_EXIT, false); + WgzMessage wgzMessage = new WgzMessage() + .setSenderType(USERTYPE_BGT) + .setRecipientType(USERTYPE_WGZ) + .setRecipientId(vo.getUserId()) + .setHeadline(map.get(HEADLINE)) + .setSubheading(map.get(SUBHEADING)) + .setTableId(vo.getRecruitId()) + .setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()) + .setMessageLargeType(LARGE_OTHER) + .setMessageSmallType(SMALL_EXIT); + wgzMessages.add(wgzMessage); + } + iWgzMessageService.saveBatch(wgzMessages); + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.in(BgtProjectRecruitApply::getId, ids) + .set(BgtProjectRecruitApply::getLeaveTime, LocalDate.now()) + .set(BgtProjectRecruitApply::getStatus, RecruitApplyStatus.OUT_WORK.getCode()); + update(wrapper); + } + } @Override @@ -330,24 +404,24 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl0){ + if (baseMapper.updateById(bgtProjectRecruitApply) > 0) { Long appUserId = SecurityUtils.getAppUserId(); BgtProjectRecruitApply by = selectByUserIdProjectRecruitApplyId(appUserId); BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getUserId()); Map mp = new HashMap<>(); - mp.put("projectName",appById.getRecruitName()); + mp.put("projectName", appById.getRecruitName()); //发送取消报名的系统消息 WgzMessage wgzMessage = new WgzMessage(). setSenderType(USERTYPE_SYSTEM). setRecipientType(USERTYPE_WGZ). setRecipientId(appUserId). - setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"103")). - setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"104")). + setHeadline(wgzMessage(mp, "103")). + setSubheading(wgzMessage(mp, "104")). setTableId(bgtProjectRecruitApply.getId()). setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()). setMessageLargeType(LARGE_OTHER). setMessageSmallType(SMALL_SYSTEM); - if (!iWgzMessageService.sendAMessage(wgzMessage)){ + if (!iWgzMessageService.sendAMessage(wgzMessage)) { throw new RuntimeException("系统消息发送失败!"); } return true; @@ -361,7 +435,7 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl pe = new Page<>(); pe.setCurrent(req.getPageNum()); pe.setSize(req.getPageSize()); - return PageUtils.buildDataInfo(baseMapper.underwayPage(pe,req)); + return PageUtils.buildDataInfo(baseMapper.underwayPage(pe, req)); } @Override @@ -376,26 +450,26 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl mp = new HashMap<>(); - mp.put("projectName",recruit.getRecruitName()); - mp.put("userName",byUserId.getUsername()); - mp.put("post",typeOfWork.getDictLabel()); - if (req.getStatus().equals("3")){ + mp.put("projectName", recruit.getRecruitName()); + mp.put("userName", byUserId.getUsername()); + mp.put("post", typeOfWork.getDictLabel()); + if (req.getStatus().equals("3")) { WgzMessage wgzMessage = new WgzMessage(). setSenderType(USERTYPE_SYSTEM). setRecipientType(USERTYPE_WGZ). setRecipientId(byUserId.getUserId()). - setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"105")). - setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"106")). + setHeadline(wgzMessage(mp, "105")). + setSubheading(wgzMessage(mp, "106")). setTableId(apply.getId()). setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()). setMessageLargeType(LARGE_APPLY); - if (!iWgzMessageService.sendAMessage(wgzMessage)){ + if (!iWgzMessageService.sendAMessage(wgzMessage)) { throw new RuntimeException("系统消息报名拒绝发送失败!"); } BgtMessage bgtMessage = new BgtMessage(). @@ -403,29 +477,29 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl bgtProjectRecruitApplyVOS = bgtProjectRecruitApplyService.appQueryList(bgtProjectRecruitApplyQueryDTO); vo.setTotalNum(bgtProjectRecruitApplyVOS.size()); int count = (int)bgtProjectRecruitApplyVOS.stream().filter(apply -> apply.getStatus().equals(RecruitApplyStatus.BGT_PASS.getCode())).count(); vo.setPassNum(count); - vo.setApplylist(bgtProjectRecruitApplyVOS.subList(0, Math.min(count, 3))); + vo.setNotSelectNum(vo.getTotalNum()-vo.getPassNum()); + vo.setApplyList(bgtProjectRecruitApplyVOS.subList(0, Math.min(count, 3))); return vo; } @@ -163,6 +170,14 @@ public class BgtProjectRecruitServiceImpl extends ServicePlusImpl getRecruitIdAndNameByTaskId(Long taskId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(BgtProjectRecruit::getTaskId, taskId); + List bgtProjectRecruits = baseMapper.selectList(wrapper); + return bgtProjectRecruits.stream().collect(Collectors.toMap(BgtProjectRecruit::getId,BgtProjectRecruit::getRecruitName)); + } + /** * LC-APP相关 * ================================================================================================================= diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectTaskProgressServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectTaskProgressServiceImpl.java index 8f2e17c..59e6b29 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectTaskProgressServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectTaskProgressServiceImpl.java @@ -12,11 +12,14 @@ import com.ruoyi.bgt.domain.dto.BgtProjectTaskProgressQueryDTO; import com.ruoyi.bgt.domain.vo.BgtProjectTaskProgressDetailVO; import com.ruoyi.bgt.domain.vo.BgtProjectTaskProgressVO; import com.ruoyi.bgt.mapper.BgtProjectTaskProgressMapper; +import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService; import com.ruoyi.bgt.service.IBgtProjectTaskProgressService; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.ProjectTaskStatus; import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.fbs.domain.FbsProjectTask; import com.ruoyi.fbs.service.IFbsProjectTaskService; import com.ruoyi.zbf.service.IZbfProjectService; import org.springframework.beans.factory.annotation.Autowired; @@ -41,6 +44,9 @@ public class BgtProjectTaskProgressServiceImpl extends ServicePlusImpl务工者================================================== + * ============================================包工头->务工者================================================== + * ============================================包工头->务工者================================================== + */ + + //模板 + public static final String BGT_SIGN_UP_APPLY_HEADLINE = "您申请的【%s】项目,已得到回复!"; + public static final String BGT_SIGN_UP_APPLY_SUBHEADING = "您申请的【%s】项目,审核人【%s】已%s!"; + public static final String BGT_PAY_APPLY_HEADLINE = "您【%s】项目工资申请已审批!"; + public static final String BGT_PAY_APPLY_SUBHEADING = "您申请的【%s】项目工资,审核人【%s】已%s!"; + public static final String BGT_LEAVE_APPLY_HEADLINE = "您【%s】项目的请假申请已审批!"; + public static final String BGT_LEAVE_APPLY_SUBHEADING = "您【%s】项目的请假申请,审核人【%s】已%s!"; + public static final String BGT_LEAVE_MAKE_UP_HEADLINE = "您【%s】项目的补卡申请已审批!"; + public static final String BGT_LEAVE_MAKE_UP_SUBHEADING = "您【%s】项目的补卡申请,审核人【%s】已%s!"; + public static final String BGT_LEAVE_EXIT_HEADLINE = "您已从【%s】项目退场!"; + public static final String BGT_LEAVE_EXIT_SUBHEADING_ONE = "您已被【%s】指定从【%s】项目退场!"; + public static final String BGT_LEAVE_EXIT_SUBHEADING_TWO = "【%s】项目已完结,自动退场!"; + + + //主副标志 + public static final String HEADLINE = "headline"; //主标题 + public static final String SUBHEADING = "subheading"; //副标题 + + //消息类型 + public static final String BGT_TYPE_SIGN_UP = "1"; //务工者报名 + public static final String BGT_TYPE_PAY = "2"; //付款 + public static final String BGT_TYPE_LEAVE = "3"; //请假 + public static final String BGT_TYPE_MAKE_UP = "4"; //补卡 + public static final String BGT_TYPE_EXIT = "5"; //退场 + + //包工头消息返回 + public static Map bgtMessage(Map mp, String type, Boolean isPass) { + Map map = new HashMap<>(); + String pass = isPass ? "通过" : "拒绝"; + String projectName = mp.get("projectName"); + String auditor = mp.get("auditor"); + switch (type) { + case "1": + map.put(HEADLINE, String.format(BGT_SIGN_UP_APPLY_HEADLINE, projectName)); + map.put(SUBHEADING, String.format(BGT_SIGN_UP_APPLY_SUBHEADING, projectName, auditor, pass)); + break; + case "2": + map.put(HEADLINE, String.format(BGT_PAY_APPLY_HEADLINE, projectName)); + map.put(SUBHEADING, String.format(BGT_PAY_APPLY_SUBHEADING, projectName, auditor, pass)); + break; + case "3": + map.put(HEADLINE, String.format(BGT_LEAVE_APPLY_HEADLINE, projectName)); + map.put(SUBHEADING, String.format(BGT_LEAVE_APPLY_SUBHEADING, projectName, auditor, pass)); + break; + case "4": + map.put(HEADLINE, String.format(BGT_LEAVE_MAKE_UP_HEADLINE, projectName)); + map.put(SUBHEADING, String.format(BGT_LEAVE_MAKE_UP_SUBHEADING, projectName, auditor, pass)); + break; + case "5": + map.put(HEADLINE, String.format(BGT_LEAVE_EXIT_HEADLINE, projectName)); + if (isPass) { + map.put(SUBHEADING, String.format(BGT_LEAVE_EXIT_SUBHEADING_ONE, auditor, projectName)); + } else { + map.put(SUBHEADING, String.format(BGT_LEAVE_EXIT_SUBHEADING_TWO, projectName)); + } + break; + default: + break; + } + return map; + } + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/common/constants/WgzAndBgtMessageConstant.java b/ruoyi-system/src/main/java/com/ruoyi/common/constants/WgzAndBgtMessageConstant.java index 7e4c5f9..6283e82 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/common/constants/WgzAndBgtMessageConstant.java +++ b/ruoyi-system/src/main/java/com/ruoyi/common/constants/WgzAndBgtMessageConstant.java @@ -1,6 +1,5 @@ package com.ruoyi.common.constants; -import java.util.HashMap; import java.util.Map; public class WgzAndBgtMessageConstant { @@ -8,6 +7,7 @@ public class WgzAndBgtMessageConstant { public static final String USERTYPE_SYSTEM = "0"; //系统 public static final String USERTYPE_WGZ = "1"; //务工者 public static final String USERTYPE_BGT = "2"; //包工头 + public static final String USERTYPE_FBS = "3"; //分包商 public static final String LARGE_APPLY = "0"; //大类型-报名 public static final String LARGE_SALARY = "1"; //大类型-工资 @@ -15,6 +15,7 @@ public class WgzAndBgtMessageConstant { public static final String SMALL_CARD = "0"; //小类型-补卡 public static final String SMALL_SYSTEM = "1"; //小类型-系统 public static final String SMALL_EXIT = "2"; //小类型-退场 + public static final String SMALL_LEAVE = "3"; //小类型-请假 /** @@ -148,67 +149,6 @@ public class WgzAndBgtMessageConstant { * =====================================================包工头===================================================== */ - //模板 - public static final String BGT_SIGN_UP_APPLY_HEADLINE = "您申请的【%s】项目,已得到回复!"; - public static final String BGT_SIGN_UP_APPLY_SUBHEADING = "您申请的【%s】项目,审核人【%s】已%s!"; - public static final String BGT_PAY_APPLY_HEADLINE = "您【%s】项目工资申请已审批!"; - public static final String BGT_PAY_APPLY_SUBHEADING = "您申请的【%s】项目工资,审核人【%s】已%s!"; - public static final String BGT_LEAVE_APPLY_HEADLINE = "您【%s】项目的请假申请已审批!"; - public static final String BGT_LEAVE_APPLY_SUBHEADING = "您【%s】项目的请假申请,审核人【%s】已%s!"; - public static final String BGT_LEAVE_MAKE_UP_HEADLINE = "您【%s】项目的补卡申请已审批!"; - public static final String BGT_LEAVE_MAKE_UP_SUBHEADING = "您【%s】项目的补卡申请,审核人【%s】已%s!"; - public static final String BGT_LEAVE_EXIT_HEADLINE = "您已从【%s】项目退场!"; - public static final String BGT_LEAVE_EXIT_SUBHEADING_ONE = "您已被【%s】指定从【%s】项目退场!"; - public static final String BGT_LEAVE_EXIT_SUBHEADING_TWO = "【%s】项目已完结,自动退场!"; - - //主副标志 - public static final String HEADLINE = "headline"; //主标题 - public static final String SUBHEADING = "subheading"; //副标题 - - //消息类型 - public static final String BGT_LARGE = "3"; //大类型固定为3 - public static final String BGT_TYPE_SIGN_UP = "1"; //务工者报名 - public static final String BGT_TYPE_PAY = "2"; //付款 - public static final String BGT_TYPE_LEAVE = "3"; //请假 - public static final String BGT_TYPE_MAKE_UP = "4"; //补卡 - public static final String BGT_TYPE_EXIT = "5"; //退场 - - //包工头消息返回 - public static Map bgtMessage(Map mp, String type,Boolean isPass) { - Map map = new HashMap<>(); - String pass = isPass ? "通过" : "拒绝"; - String projectName = mp.get("projectName"); - String auditor = mp.get("auditor"); - switch (type){ - case "1": - map.put(HEADLINE, String.format(BGT_SIGN_UP_APPLY_HEADLINE, projectName)); - map.put(SUBHEADING, String.format(BGT_SIGN_UP_APPLY_SUBHEADING, projectName,auditor,pass)); - break; - case "2": - map.put(HEADLINE, String.format(BGT_PAY_APPLY_HEADLINE, projectName)); - map.put(SUBHEADING, String.format(BGT_PAY_APPLY_SUBHEADING, projectName,auditor,pass)); - break; - case "3": - map.put(HEADLINE, String.format(BGT_LEAVE_APPLY_HEADLINE, projectName)); - map.put(SUBHEADING, String.format(BGT_LEAVE_APPLY_SUBHEADING, projectName,auditor,pass)); - break; - case "4": - map.put(HEADLINE, String.format(BGT_LEAVE_MAKE_UP_HEADLINE, projectName)); - map.put(SUBHEADING, String.format(BGT_LEAVE_MAKE_UP_SUBHEADING, projectName,auditor,pass)); - break; - case "5": - map.put(HEADLINE, String.format(BGT_LEAVE_EXIT_HEADLINE, projectName)); - if(isPass){ - map.put(SUBHEADING, String.format(BGT_LEAVE_EXIT_SUBHEADING_ONE, auditor,projectName)); - }else { - map.put(SUBHEADING, String.format(BGT_LEAVE_EXIT_SUBHEADING_TWO, projectName)); - } - break; - default: - break; - } - return map; - } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzLeaveService.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzLeaveService.java index 37f0952..9455bfa 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzLeaveService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzLeaveService.java @@ -1,13 +1,14 @@ package com.ruoyi.wgz.service; +import com.ruoyi.bgt.domain.dto.BgtLeaveUpdateDTO; +import com.ruoyi.common.core.mybatisplus.core.IServicePlus; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.wgz.bo.WgzLeaveQueryBo; import com.ruoyi.wgz.bo.req.WgzAppCancelLeaveReq; import com.ruoyi.wgz.bo.req.WgzAppLeaveHistoryListPageReq; import com.ruoyi.wgz.bo.req.WgzAppSubmitLeaveReq; import com.ruoyi.wgz.bo.res.WgzAppLeaveHistoryListPageRes; import com.ruoyi.wgz.domain.WgzLeave; -import com.ruoyi.wgz.bo.WgzLeaveQueryBo; -import com.ruoyi.common.core.mybatisplus.core.IServicePlus; -import com.ruoyi.common.core.page.TableDataInfo; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestBody; @@ -93,4 +94,10 @@ public interface IWgzLeaveService extends IServicePlus { * 查看指定人、指定项目、指定日期是否请假 */ WgzLeave FindAskForLeaveOrNotInfo(Long appUserId, Long recruitId, String date); + + /** + * 包工头审核 + */ + Boolean bgtAudit(BgtLeaveUpdateDTO dto); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java index fb2a1fc..753a7da 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java @@ -1,40 +1,47 @@ package com.ruoyi.wgz.service.impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; import com.ruoyi.bgt.domain.BgtProjectRecruit; import com.ruoyi.bgt.domain.BgtProjectRecruitApply; -import com.ruoyi.bgt.domain.dto.BgtProjectTaskProgressQueryDTO; +import com.ruoyi.bgt.domain.dto.BgtLeaveUpdateDTO; import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService; import com.ruoyi.bgt.service.IBgtProjectRecruitService; -import com.ruoyi.common.utils.PageUtils; +import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.AuditStatus; +import com.ruoyi.common.utils.PageUtils; import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.wgz.bo.WgzLeaveQueryBo; import com.ruoyi.wgz.bo.req.WgzAppCancelLeaveReq; import com.ruoyi.wgz.bo.req.WgzAppLeaveHistoryListPageReq; import com.ruoyi.wgz.bo.req.WgzAppSubmitLeaveReq; import com.ruoyi.wgz.bo.res.WgzAppLeaveHistoryListPageRes; -import com.ruoyi.wgz.domain.WgzDailyClock; -import org.springframework.beans.BeanUtils; +import com.ruoyi.wgz.domain.WgzAttendance; +import com.ruoyi.wgz.domain.WgzLeave; +import com.ruoyi.wgz.domain.WgzMessage; +import com.ruoyi.wgz.mapper.WgzLeaveMapper; +import com.ruoyi.wgz.service.IWgzAttendanceService; +import com.ruoyi.wgz.service.IWgzLeaveService; +import com.ruoyi.wgz.service.IWgzMessageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ruoyi.wgz.bo.WgzLeaveQueryBo; -import com.ruoyi.wgz.domain.WgzLeave; -import com.ruoyi.wgz.mapper.WgzLeaveMapper; -import com.ruoyi.wgz.service.IWgzLeaveService; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; import java.time.LocalDateTime; -import java.time.LocalTime; -import java.time.format.DateTimeFormatter; -import java.util.*; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.ruoyi.common.constants.BgtMessageConstant.*; +import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*; /** * 请假Service业务层处理 @@ -50,6 +57,12 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl mp = new HashMap<>(); + mp.put("projectName",recruit.getRecruitName()); + mp.put("auditor",SecurityUtils.getUsername()); + Map map = bgtMessage(mp, BGT_TYPE_LEAVE, AuditStatus.PASS.getCode().equals(dto.getAuditorType())); + WgzMessage wgzMessage = new WgzMessage() + .setSenderType(USERTYPE_BGT) + .setRecipientType(USERTYPE_WGZ) + .setRecipientId(wgzLeave.getUserId()) + .setHeadline(map.get(HEADLINE)) + .setSubheading(map.get(SUBHEADING)) + .setTableId(wgzLeave.getId()) + .setTableName(SqlHelper.table(WgzLeave.class).getTableName()) + .setMessageLargeType(LARGE_OTHER) + .setMessageSmallType(SMALL_LEAVE); + wgzMessageService.sendAMessage(wgzMessage); + + //考勤信息 + List list = attendanceService.list(Wrappers.lambdaQuery() + .eq(WgzAttendance::getRecruitId, recruit.getId()) + .eq(WgzAttendance::getUserId, wgzLeave.getUserId()) + .eq(WgzAttendance::getDate, wgzLeave.getStartTime().toLocalDate())); + if(CollectionUtil.isNotEmpty(list)){ + WgzAttendance wgzAttendance = list.get(0); + wgzAttendance.setLeaveMarkId(wgzLeave.getId()); + wgzAttendance.setExceptionType("7"); + attendanceService.updateById(wgzAttendance); + }else { + WgzAttendance wgzAttendance = new WgzAttendance(); + wgzAttendance.setRecruitId(recruit.getId()); + wgzAttendance.setUserId(wgzLeave.getUserId()); + wgzAttendance.setLeaveMarkId(wgzLeave.getId()); + wgzAttendance.setDailyWage(recruit.getRecruitAmount()); + wgzAttendance.setDate(wgzLeave.getStartTime().toLocalDate()); + wgzAttendance.setExceptionType("7"); + attendanceService.save(wgzAttendance); + } + return updateById(wgzLeave); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzPayCalculationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzPayCalculationServiceImpl.java index dd8c002..f291039 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzPayCalculationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzPayCalculationServiceImpl.java @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; -import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; import com.ruoyi.bgt.domain.BgtMessage; import com.ruoyi.bgt.domain.BgtProjectRecruit; import com.ruoyi.bgt.domain.BgtProjectRecruitApply; @@ -34,7 +33,6 @@ import com.ruoyi.wgz.domain.WgzMessage; import com.ruoyi.wgz.domain.WgzPayCalculation; import com.ruoyi.wgz.domain.WgzPayCalculationFiles; import com.ruoyi.wgz.domain.WgzUser; -import com.ruoyi.wgz.domain.*; import com.ruoyi.wgz.mapper.WgzPayCalculationMapper; import com.ruoyi.wgz.service.*; import org.springframework.beans.BeanUtils; @@ -49,11 +47,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static com.ruoyi.common.constants.BgtMessageConstant.*; import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*; -import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*; -import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.SMALL_SYSTEM; - /** * 工资结算Service业务层处理 * @@ -214,8 +210,8 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl mp = new HashMap<>(); mp.put("projectName",iBgtProjectRecruitService.getById(payCalculation.getRecruitId()).getRecruitName()); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzReissueacardServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzReissueacardServiceImpl.java index e54d54f..45c08c3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzReissueacardServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzReissueacardServiceImpl.java @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; -import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; import com.ruoyi.bgt.domain.BgtMessage; import com.ruoyi.bgt.domain.BgtProjectRecruit; import com.ruoyi.bgt.domain.BgtProjectRecruitApply; @@ -37,10 +36,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.math.BigDecimal; import java.time.format.DateTimeFormatter; import java.util.*; +import static com.ruoyi.common.constants.BgtMessageConstant.*; import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*; /** @@ -207,8 +206,8 @@ public class WgzReissueacardServiceImpl extends ServicePlusImpl - diff --git a/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitApplyMapper.xml b/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitApplyMapper.xml index 51c5356..d0cfc8a 100644 --- a/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitApplyMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/bgt/BgtProjectRecruitApplyMapper.xml @@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"