3.14优化
This commit is contained in:
@ -254,11 +254,21 @@ public class BgtProjectRecruitServiceImpl extends ServicePlusImpl<BgtProjectRecr
|
||||
pe.setCurrent(req.getPageNum());
|
||||
pe.setSize(req.getPageSize());
|
||||
TableDataInfo<WgzAppRegisteredProjectRes> wgzAppRegisteredProjectResTableDataInfo = PageUtils.buildDataInfo(baseMapper.userRegisteredProject(pe, userId));
|
||||
// wgzAppRegisteredProjectResTableDataInfo.getRows().forEach(registeredProjectRes -> {
|
||||
// //1、获取当前用户的满员、失效、同意、拒绝、报名状态
|
||||
// //1、获取当前项目下的成员
|
||||
// List<WgzAppCancelRegistrationProjectDetailsTwo> wgzUser = baseMapper.GetsTheMembersUnderTheCurrentProject(registeredProjectRes.getId());
|
||||
// });
|
||||
wgzAppRegisteredProjectResTableDataInfo.getRows().forEach(registeredProjectRes -> {
|
||||
//4、根据招工申请ID获取到消息
|
||||
WgzMessage one = iWgzMessageService.getOne(
|
||||
Wrappers.<WgzMessage>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;
|
||||
}
|
||||
|
||||
|
@ -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<String, String> 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 "未知类型";
|
||||
}
|
||||
|
@ -75,4 +75,9 @@ public class WgzAppRegisteredProjectRes implements Serializable {
|
||||
private String statusApply;
|
||||
|
||||
|
||||
@ApiModelProperty("招工创建人")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty("消息主键ID")
|
||||
private Long messageId;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
@ -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<WgzLeave> {
|
||||
*/
|
||||
Page<WgzAppLeaveHistoryListPageRes> userLeaveHistoryListPage(@Param("page") Page<WgzAppLeaveHistoryListPageReq> 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);
|
||||
|
||||
}
|
||||
|
@ -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<WgzLeave> {
|
||||
*/
|
||||
Boolean userCancelLeave(@Validated @RequestBody WgzAppCancelLeaveReq req);
|
||||
|
||||
/**
|
||||
* 查看请假详情
|
||||
*/
|
||||
WgzAppUserLeaveDetailsRes userLeaveDetails(@NotNull(message = "主键不能为空") @PathVariable("id") Long id);
|
||||
|
||||
/*
|
||||
* 查看指定人、指定项目、指定月是否请假(只传递年月)
|
||||
*/
|
||||
|
@ -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<WgzLeaveMapper, WgzLeav
|
||||
private IBgtProjectRecruitService iBgtProjectRecruitService;
|
||||
|
||||
@Autowired
|
||||
private IWgzMessageService wgzMessageService;
|
||||
private IWgzAttendanceService attendanceService;
|
||||
|
||||
@Autowired
|
||||
private IWgzAttendanceService attendanceService;
|
||||
@Lazy
|
||||
private IWgzMessageService iWgzMessageService;
|
||||
|
||||
@Autowired
|
||||
private IBgtMessageService iBgtMessageService;
|
||||
|
||||
@Override
|
||||
public WgzLeave queryById(Long id){
|
||||
@ -140,14 +147,33 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl<WgzLeaveMapper, WgzLeav
|
||||
@Transactional
|
||||
public Boolean userSubmitLeave(WgzAppSubmitLeaveReq req) {
|
||||
//1、现获取用户的唯一标识
|
||||
Long appUserId = SecurityUtils.getAppUserId();
|
||||
SysUser user = SecurityUtils.getLoginUser().getUser();
|
||||
Long appUserId = user.getUserId();
|
||||
//2、根据唯一标识获取到当前用户的招工
|
||||
BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId);
|
||||
//3、根据招工id获取到具体招工信息
|
||||
BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getId());
|
||||
BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getRecruitId());
|
||||
//4、查看当前用户、当前招工、当前请假时间段是否有重复的请假
|
||||
LocalDate startDate = req.getStartTime().toLocalDate();
|
||||
LocalDate endDate = req.getEndTime().toLocalDate();
|
||||
List<LocalDate> rqList = new ArrayList<>();
|
||||
for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) {
|
||||
rqList.add(date);
|
||||
}
|
||||
Integer num = baseMapper.selectCount(Wrappers.<WgzLeave>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 ServicePlusImpl<WgzLeaveMapper, WgzLeav
|
||||
setAuditorUserId(appById.getUserId()).
|
||||
setWorkingTime(appById.getBeginWorkTime()).
|
||||
setClosingTime(appById.getEndWorkTime());
|
||||
return baseMapper.insert(wgzLeave)>0;
|
||||
int insert = baseMapper.insert(wgzLeave);
|
||||
if (insert > 0) {
|
||||
Map<String, String> 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 ServicePlusImpl<WgzLeaveMapper, WgzLeav
|
||||
return baseMapper.updateById(wgzLeave)>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WgzAppUserLeaveDetailsRes userLeaveDetails(Long id) {
|
||||
return baseMapper.userLeaveDetails(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<LocalDate, LocalDate> selectByUserCancelLeave(String yearMonth) {
|
||||
Map<LocalDate, LocalDate> ld = new HashMap<>();
|
||||
@ -237,7 +304,7 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl<WgzLeaveMapper, WgzLeav
|
||||
.setTableName(SqlHelper.table(WgzLeave.class).getTableName())
|
||||
.setMessageLargeType(LARGE_OTHER)
|
||||
.setMessageSmallType(SMALL_LEAVE);
|
||||
wgzMessageService.sendAMessage(wgzMessage);
|
||||
iWgzMessageService.sendAMessage(wgzMessage);
|
||||
|
||||
//考勤信息
|
||||
List<WgzAttendance> list = attendanceService.list(Wrappers.<WgzAttendance>lambdaQuery()
|
||||
|
@ -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<WgzPayCalculat
|
||||
@Autowired
|
||||
private IWgzPayCalculationMiddleService iWgzPayCalculationMiddleService;
|
||||
|
||||
@Autowired
|
||||
private IWgzMessageService iWgzMessageService;
|
||||
|
||||
@Autowired
|
||||
private IBgtMessageService iBgtMessageService;
|
||||
|
||||
@Override
|
||||
public WgzPayCalculation queryById(Long id){
|
||||
return getById(id);
|
||||
@ -188,29 +197,29 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
//3、把需要结算的数据标记为已结算
|
||||
List<WgzAttendance> 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<WgzPayCalculationMiddle> listMiddle = new ArrayList<>();
|
||||
@ -220,9 +229,43 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
.setAttendanceId(data.getId());
|
||||
listMiddle.add(middle);
|
||||
}
|
||||
iWgzPayCalculationMiddleService.saveBatch(listMiddle);
|
||||
|
||||
|
||||
boolean middleSave = iWgzPayCalculationMiddleService.saveBatch(listMiddle);
|
||||
if (!middleSave){
|
||||
throw new RuntimeException("中间数据存储失败!");
|
||||
}
|
||||
//6、消息通知
|
||||
WgzUser byId = wgzUserService.findByUserId(user.getUserId());
|
||||
Map<String, String> 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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -29,8 +29,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="userLeaveHistoryListPage" resultType="com.ruoyi.wgz.bo.res.WgzAppLeaveHistoryListPageRes">
|
||||
SELECT
|
||||
a.*,
|
||||
b.username,
|
||||
b.avatar_name
|
||||
b.username as auditorname,
|
||||
b.avatar_name as auditorHead
|
||||
FROM
|
||||
wgz_leave a
|
||||
LEFT JOIN bgt_user b ON (a.auditor_user_id = b.user_id and b.del_flag = 0)
|
||||
|
Reference in New Issue
Block a user