From d0afc832195edc3e702bd1810fcddd2caedad7c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E6=88=90?= <2847920761@qq.com> Date: Fri, 14 Mar 2025 18:31:32 +0800 Subject: [PATCH] =?UTF-8?q?3.14=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wgz/controller/WgzAppController.java | 13 ++- .../impl/BgtProjectRecruitServiceImpl.java | 20 +++- .../constants/WgzAndBgtMessageConstant.java | 15 +++ .../bo/res/WgzAppRegisteredProjectRes.java | 5 + .../bo/res/WgzAppUserGetTheApproverRes.java | 10 +- .../wgz/bo/res/WgzAppUserLeaveDetailsRes.java | 95 +++++++++++++++++++ .../com/ruoyi/wgz/mapper/WgzLeaveMapper.java | 20 ++++ .../ruoyi/wgz/service/IWgzLeaveService.java | 10 ++ .../wgz/service/impl/WgzLeaveServiceImpl.java | 89 ++++++++++++++--- .../impl/WgzPayCalculationServiceImpl.java | 61 ++++++++++-- .../mapper/wgz/WgzDailyClockMapper.xml | 3 +- .../resources/mapper/wgz/WgzLeaveMapper.xml | 4 +- 12 files changed, 310 insertions(+), 35 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserLeaveDetailsRes.java 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 2bbd8e4..6302462 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 @@ -225,6 +225,16 @@ return AjaxResult.success(iWgzLeaveService.userCancelLeave(req)); } + /** + * 【我的】【请假】 请假详情 + */ + @ApiOperation("【我的】【请假】 请假详情") + //@PreAuthorize("@ss.hasPermi('wgzApp:user:userLeaveDetails')") + @GetMapping("/WgzAppUserLeaveDetails/{id}") + public AjaxResult userLeaveDetails(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) { + return AjaxResult.success(iWgzLeaveService.userLeaveDetails(id)); + } + /** * 【日报】日报日历 */ @@ -632,7 +642,8 @@ return AjaxResult.success(new WgzAppUserGetTheApproverRes(). setUserId(byId.getUserId()). setUsername(byId.getUsername()). - setAvatarName(byId.getAvatarName()) + setAvatarName(byId.getAvatarName()). + setRecruitName(appById.getRecruitName()) ); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitServiceImpl.java index d48d76a..9acb624 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/bgt/service/impl/BgtProjectRecruitServiceImpl.java @@ -254,11 +254,21 @@ public class BgtProjectRecruitServiceImpl extends ServicePlusImpl wgzAppRegisteredProjectResTableDataInfo = PageUtils.buildDataInfo(baseMapper.userRegisteredProject(pe, userId)); -// wgzAppRegisteredProjectResTableDataInfo.getRows().forEach(registeredProjectRes -> { -// //1、获取当前用户的满员、失效、同意、拒绝、报名状态 -// //1、获取当前项目下的成员 -// List wgzUser = baseMapper.GetsTheMembersUnderTheCurrentProject(registeredProjectRes.getId()); -// }); + wgzAppRegisteredProjectResTableDataInfo.getRows().forEach(registeredProjectRes -> { + //4、根据招工申请ID获取到消息 + WgzMessage one = iWgzMessageService.getOne( + Wrappers.lambdaQuery() + .in(WgzMessage::getSenderType, USERTYPE_BGT) + .in(WgzMessage::getSenderId, registeredProjectRes.getUserId()) + .in(WgzMessage::getRecipientType, USERTYPE_WGZ) + .in(WgzMessage::getRecipientId, userId) + .in(WgzMessage::getTableId, registeredProjectRes.getRecruitApplyId()) + .in(WgzMessage::getTableName, SqlHelper.table(BgtProjectRecruitApply.class).getTableName()) + ); + if (one !=null){ + registeredProjectRes.setMessageId(one.getId()); + } + }); return wgzAppRegisteredProjectResTableDataInfo; } 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 429637a..a2e5ce9 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 @@ -66,6 +66,9 @@ public class WgzAndBgtMessageConstant { //【日报补卡】19-20 public static final String WGZ_SYSTEM_HEADLINE_DAILY = "您成功发送【%s】日的日报补卡!"; public static final String WGZ_SYSTEM_SUBHEADING_DAILY = "您在【%s】日的日报补卡已成功发起!"; + //【请假】21-22 + public static final String WGZ_SYSTEM_HEADLINE_Leave = "您已成功发起申请的【%s】的请假申请!"; + public static final String WGZ_SYSTEM_SUBHEADING_Leave = "您在【%s】~【%s】的请假申请已送达到~"; /** * 务工者给包工头提示 */ @@ -87,6 +90,9 @@ public class WgzAndBgtMessageConstant { //【日报补卡】11-12 public static final String WGZ_HEADLINE_DAILY = "务工者【%s】正在向你发起【%s】日的日报补卡!"; public static final String WGZ__SUBHEADING_DAILY = "务工者【%s】向你发起【%s】日的日报补卡,请注意查收处理!"; + //【日报补卡】11-12 + public static final String WGZ_HEADLINE_DAILY_Leave = "务工者【%s】正在向你发起【%s】日的请假申请!"; + public static final String WGZ__SUBHEADING_DAILY_Leave = "务工者【%s】向你发起【%s】~【%s】日的请假申请,请注意查收处理!"; //务工者消息返回 public static String wgzMessage(Map mp, String type) { @@ -137,6 +143,10 @@ public class WgzAndBgtMessageConstant { return String.format(WGZ_SYSTEM_HEADLINE_DAILY,mp.get("data")); case "120": return String.format(WGZ_SYSTEM_SUBHEADING_DAILY, mp.get("data")); + case "121": + return String.format(WGZ_SYSTEM_HEADLINE_Leave,mp.get("data")); + case "122": + return String.format(WGZ_SYSTEM_SUBHEADING_Leave, mp.get("sData"),mp.get("eData")); //务工者向包工头申请报名 case "201": return String.format(WGZ_HEADLINE_APPLY, mp.get("userName"), mp.get("post")); @@ -167,6 +177,11 @@ public class WgzAndBgtMessageConstant { return String.format(WGZ_HEADLINE_DAILY, mp.get("userName"),mp.get("data")); case "212": return String.format(WGZ__SUBHEADING_DAILY, mp.get("userName"),mp.get("data")); + //务工者向包工头发起请假 + case "213": + return String.format(WGZ_HEADLINE_DAILY_Leave, mp.get("userName"),mp.get("data")); + case "214": + return String.format(WGZ__SUBHEADING_DAILY_Leave, mp.get("userName"),mp.get("sData"),mp.get("eData")); default: return "未知类型"; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppRegisteredProjectRes.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppRegisteredProjectRes.java index 7c18b99..fc1dbf6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppRegisteredProjectRes.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppRegisteredProjectRes.java @@ -75,4 +75,9 @@ public class WgzAppRegisteredProjectRes implements Serializable { private String statusApply; + @ApiModelProperty("招工创建人") + private String userId; + + @ApiModelProperty("消息主键ID") + private Long messageId; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserGetTheApproverRes.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserGetTheApproverRes.java index 85d868b..41ca6b0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserGetTheApproverRes.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserGetTheApproverRes.java @@ -14,18 +14,16 @@ import java.io.Serializable; @Accessors(chain = true) @ApiModel("通用审批人信息返回") public class WgzAppUserGetTheApproverRes implements Serializable { - /** 唯一标识 */ - @Excel(name = "唯一标识") + @ApiModelProperty("唯一标识") private Long userId; - /** 姓名 */ - @Excel(name = "姓名") @ApiModelProperty("姓名") private String username; - /** 头像地址 */ - @Excel(name = "头像地址") @ApiModelProperty("头像地址") private String avatarName; + + @ApiModelProperty("招工主题") + private String recruitName; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserLeaveDetailsRes.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserLeaveDetailsRes.java new file mode 100644 index 0000000..17c57e0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserLeaveDetailsRes.java @@ -0,0 +1,95 @@ +package com.ruoyi.wgz.bo.res; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.ruoyi.common.annotation.Excel; +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.time.LocalDateTime; +import java.time.LocalTime; + + +@Data +@NoArgsConstructor +@Accessors(chain = true) +@ApiModel("请假详情返回") +public class WgzAppUserLeaveDetailsRes implements Serializable { + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @ApiModelProperty("请假人") + private Long userId; + + @ApiModelProperty("请假人名称") + private String username; + + @ApiModelProperty("请假人头像") + private String avatarName; + + @ApiModelProperty("招工主题") + private String subject; + + @ApiModelProperty("请假类型(字典)") + private String leaveType; + + @ApiModelProperty("开始时间") + private LocalDateTime startTime; + + @ApiModelProperty("结束时间") + private LocalDateTime endTime; + + @ApiModelProperty("请假事由") + private String reason; + + @ApiModelProperty("审核人ID") + private Long auditorUserId; + + @ApiModelProperty("审核人名称") + private String auditorname; + + @ApiModelProperty("审核人头像") + private String auditorHead; + + @ApiModelProperty("审核状态(0待审核 1审核中 2已同意 3已拒绝 4=已取消)") + private String auditorType; + + @ApiModelProperty("审核意见") + private String auditorOpinion; + + @ApiModelProperty("同意|拒绝时间") + private LocalDateTime auditorTime; + + @ApiModelProperty("上班时间") + private LocalTime workingTime; + + @ApiModelProperty("下班时间") + private LocalTime closingTime; + + @ApiModelProperty("取消请假") + private LocalDateTime cancelLeave; + + @ApiModelProperty("删除标志(0代表存在 2代表删除)") + private String delFlag; + + @ApiModelProperty("创建者") + private String createBy; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + @ApiModelProperty("更新者") + private String updateBy; + + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; + + @ApiModelProperty("备注") + private String remark; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzLeaveMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzLeaveMapper.java index 183060b..06c56ff 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzLeaveMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzLeaveMapper.java @@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.wgz.bo.req.WgzAppLeaveHistoryListPageReq; import com.ruoyi.wgz.bo.res.WgzAppLeaveHistoryListPageRes; +import com.ruoyi.wgz.bo.res.WgzAppUserLeaveDetailsRes; import com.ruoyi.wgz.domain.WgzLeave; 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.Param; +import org.apache.ibatis.annotations.Select; /** * 请假Mapper接口 @@ -27,4 +29,22 @@ public interface WgzLeaveMapper extends BaseMapperPlus { */ Page userLeaveHistoryListPage(@Param("page") Page page); + + @Select("SELECT\n" + + " a.*,\n" + + " b.username AS username,\n" + + " b.avatar_name AS avatarName,\n" + + " c.username AS auditorname,\n" + + " c.avatar_name AS auditorHead \n" + + "FROM\n" + + " wgz_leave a\n" + + " LEFT JOIN wgz_user b ON ( a.user_id = b.user_id) \n" + + " LEFT JOIN bgt_user c ON ( a.auditor_user_id = c.user_id) \n" + + "WHERE\n" + + " a.id = #{id} and \n" + + " a.del_flag = 0 \n" + + "ORDER BY\n" + + " a.id DESC") + WgzAppUserLeaveDetailsRes userLeaveDetails(@Param("id") Long id); + } 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 9455bfa..e5e295e 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,6 +1,7 @@ package com.ruoyi.wgz.service; import com.ruoyi.bgt.domain.dto.BgtLeaveUpdateDTO; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.mybatisplus.core.IServicePlus; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.wgz.bo.WgzLeaveQueryBo; @@ -8,10 +9,14 @@ 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.bo.res.WgzAppUserLeaveDetailsRes; +import com.ruoyi.wgz.bo.res.WgzAppUserReplacementCardRecordDetailsRes; import com.ruoyi.wgz.domain.WgzLeave; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; +import javax.validation.constraints.NotNull; import java.time.LocalDate; import java.util.Collection; import java.util.List; @@ -85,6 +90,11 @@ public interface IWgzLeaveService extends IServicePlus { */ Boolean userCancelLeave(@Validated @RequestBody WgzAppCancelLeaveReq req); + /** + * 查看请假详情 + */ + WgzAppUserLeaveDetailsRes userLeaveDetails(@NotNull(message = "主键不能为空") @PathVariable("id") Long id); + /* * 查看指定人、指定项目、指定月是否请假(只传递年月) */ 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 9eecdf4..4c859b6 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 @@ -7,11 +7,14 @@ 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.BgtMessage; import com.ruoyi.bgt.domain.BgtProjectRecruit; import com.ruoyi.bgt.domain.BgtProjectRecruitApply; import com.ruoyi.bgt.domain.dto.BgtLeaveUpdateDTO; +import com.ruoyi.bgt.service.IBgtMessageService; import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService; import com.ruoyi.bgt.service.IBgtProjectRecruitService; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.AuditStatus; @@ -23,6 +26,8 @@ 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.bo.res.WgzAppUserLeaveDetailsRes; +import com.ruoyi.wgz.bo.res.WgzAppUserReplacementCardRecordDetailsRes; import com.ruoyi.wgz.domain.WgzAttendance; import com.ruoyi.wgz.domain.WgzLeave; import com.ruoyi.wgz.domain.WgzMessage; @@ -31,15 +36,13 @@ 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.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; import java.time.LocalDateTime; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import static com.ruoyi.common.constants.BgtMessageConstant.*; import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*; @@ -59,10 +62,14 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl rqList = new ArrayList<>(); + for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) { + rqList.add(date); + } + Integer num = baseMapper.selectCount(Wrappers.lambdaQuery(). + eq(WgzLeave::getRecruitId, by.getRecruitId()). + eq(WgzLeave::getUserId, appUserId). + and( + inner -> inner.in(WgzLeave::getStartTime, rqList).or().in(WgzLeave::getEndTime, rqList) + ). + ne(WgzLeave::getAuditorType, "4") + ); + if (num > 0) { + throw new RuntimeException("当前时间段已存在请假!"); + } //6、组装请假对象数据 并插入 WgzLeave wgzLeave = new WgzLeave(). - setRecruitId(by.getId()). + setRecruitId(by.getRecruitId()). setSubject(appById.getRecruitName()). setUserId(appUserId). setLeaveType(req.getLeaveType()). @@ -157,7 +183,43 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl0; + int insert = baseMapper.insert(wgzLeave); + if (insert > 0) { + Map mp = new HashMap<>(); + mp.put("userName",user.getUserName()); + mp.put("data",wgzLeave.getStartTime().toLocalDate().toString()); + mp.put("sData",wgzLeave.getStartTime().toLocalDate().toString()); + mp.put("eData",wgzLeave.getEndTime().toLocalDate().toString()); + + WgzMessage wgzMessage = new WgzMessage(). + setSenderType(USERTYPE_SYSTEM). + setRecipientType(USERTYPE_WGZ). + setRecipientId(appUserId). + setHeadline(wgzMessage(mp, "121")). + setSubheading(wgzMessage(mp, "122")). + setTableId(wgzLeave.getId()). + setTableName(SqlHelper.table(WgzLeave.class).getTableName()). + setMessageLargeType(LARGE_OTHER). + setMessageSmallType(SMALL_LEAVE); + if (!iWgzMessageService.sendAMessage(wgzMessage)) { + throw new RuntimeException("系统消息请假申请发送失败!"); + } + BgtMessage bgtMessage = new BgtMessage(). + setSenderType(USERTYPE_WGZ). + setSenderId(appUserId). + setRecipientType(USERTYPE_BGT). + setRecipientId(appById.getUserId()). + setHeadline(wgzMessage(mp, "213")). + setSubheading(wgzMessage(mp, "214")). + setTableId(wgzLeave.getId()). + setTableName(SqlHelper.table(WgzLeave.class).getTableName()). + setMessageLargeType(BGT_LARGE_OTHER). + setMessageSmallType(BGT_SMALL_LEAVE); + if (!iBgtMessageService.sendAMessage(bgtMessage)) { + throw new RuntimeException("发送请假申请消息失败!"); + } + } + return true; } @Override @@ -178,6 +240,11 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl0; } + @Override + public WgzAppUserLeaveDetailsRes userLeaveDetails(Long id) { + return baseMapper.userLeaveDetails(id); + } + @Override public Map selectByUserCancelLeave(String yearMonth) { Map ld = new HashMap<>(); @@ -237,7 +304,7 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl list = attendanceService.list(Wrappers.lambdaQuery() 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 ec5676b..b95079a 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 @@ -7,6 +7,7 @@ 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.BgtMessage; import com.ruoyi.bgt.domain.BgtProjectRecruit; import com.ruoyi.bgt.domain.BgtProjectRecruitApply; import com.ruoyi.bgt.domain.dto.BgtApplyForWgzPayAddDTO; @@ -16,9 +17,11 @@ import com.ruoyi.bgt.domain.dto.BgtPayCalculationUpdateDTO; import com.ruoyi.bgt.domain.vo.BgtApplyForWgzPayAddInfoVO; import com.ruoyi.bgt.domain.vo.BgtPayCalculationDetailBaseVO; import com.ruoyi.bgt.domain.vo.BgtPayCalculationDetailListVO; +import com.ruoyi.bgt.service.IBgtMessageService; import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService; import com.ruoyi.bgt.service.IBgtProjectRecruitService; import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constants.WgzAndBgtMessageConstant; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; import com.ruoyi.common.core.page.TableDataInfo; @@ -84,6 +87,12 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl objects = new ArrayList<>(); for (WgzAttendance data : attList) { -// WgzPayCalculationMiddle middle = new WgzPayCalculationMiddle() -// .setCalculationId(data.getId()) -// .setAttendanceId(data.getId()); objects.add(new WgzAttendance() .setId(data.getId()) .setSettlement(1) ); } - //4、修改标识符,新增结算数据 boolean b = iWgzAttendanceService.updateBatchById(objects); if (!b) { throw new RuntimeException("标识符修改失败!"); } + //4、新增结算数据及结算附件 WgzPayCalculation wgzPayCalculation = new WgzPayCalculation(); BeanUtils.copyProperties(req,wgzPayCalculation); wgzPayCalculation. setUserId(user.getUserId()). setUserName(user.getUserName()). setAuditorUserId(recruit.getUserId()); - iWgzPayCalculationFilesService.saveBatch(req.getPayCalculation()); + boolean fjSave = iWgzPayCalculationFilesService.saveBatch(req.getPayCalculation()); + if (!fjSave) { + throw new RuntimeException("附件新增失败!"); + } boolean save = save(wgzPayCalculation); if (!save) { - throw new RuntimeException("新增结算失败!"); + throw new RuntimeException("结算新增失败!"); } //5、将修改标识符的数据存放到中间表 List listMiddle = new ArrayList<>(); @@ -220,9 +229,43 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl mp = new HashMap<>(); + mp.put("projectName", recruit.getRecruitName()); + mp.put("userName", byId.getUsername()); + mp.put("num", String.valueOf(wgzPayCalculation.getNum())); + mp.put("money", String.valueOf(new BigDecimal(wgzPayCalculation.getNum()).multiply(wgzPayCalculation.getRecruitAmount()))); + WgzMessage wgzMessage = new WgzMessage(). + setSenderType(USERTYPE_SYSTEM). + setRecipientType(USERTYPE_WGZ). + setRecipientId(user.getUserId()). + setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"111")). + setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"112")). + setTableId(wgzPayCalculation.getId()). + setTableName(SqlHelper.table(WgzPayCalculation.class).getTableName()). + setMessageLargeType(LARGE_SALARY); + if (!iWgzMessageService.sendAMessage(wgzMessage)){ + throw new RuntimeException("系统工资结算消息发送失败!"); + } + BgtMessage bgtMessage = new BgtMessage(). + setSenderType(USERTYPE_WGZ). + setSenderId(user.getUserId()). + setRecipientType(USERTYPE_BGT). + setRecipientId(recruit.getUserId()). + setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"209")). + setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"210")). + setTableId(wgzPayCalculation.getId()). + setTableName(SqlHelper.table(WgzPayCalculation.class).getTableName()). + setMessageLargeType(BGT_LARGE_OTHER). + setMessageSmallType(BGT_SMALL_PAY); + if (!iBgtMessageService.sendAMessage(bgtMessage)){ + throw new RuntimeException("发送补卡消息失败!"); + } return true; } diff --git a/ruoyi-system/src/main/resources/mapper/wgz/WgzDailyClockMapper.xml b/ruoyi-system/src/main/resources/mapper/wgz/WgzDailyClockMapper.xml index a4d1548..fbcd7f5 100644 --- a/ruoyi-system/src/main/resources/mapper/wgz/WgzDailyClockMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wgz/WgzDailyClockMapper.xml @@ -37,7 +37,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" b.avatar_name, a.dily_time, a.finish_today, - a.auditor_type + a.auditor_type, + a.status FROM wgz_daily_clock a LEFT JOIN wgz_user b ON (a.user_id = b.user_id and b.del_flag = 0) diff --git a/ruoyi-system/src/main/resources/mapper/wgz/WgzLeaveMapper.xml b/ruoyi-system/src/main/resources/mapper/wgz/WgzLeaveMapper.xml index 9f9158f..d7826ed 100644 --- a/ruoyi-system/src/main/resources/mapper/wgz/WgzLeaveMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wgz/WgzLeaveMapper.xml @@ -29,8 +29,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"